Skip to content

Commit 9ff9eb9

Browse files
authored
Corrected type names
Plus added some extra info and tweaked the appearance
1 parent c90108f commit 9ff9eb9

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,53 +46,52 @@ document.addEventListener("mousemove", function(mouse){
4646

4747
## Options
4848

49-
### `my` - [`PositionAlignment`][pa]
49+
### my: [`Alignment`][alignment]
5050

5151
The location on the `target` to position from
5252

53-
### `at` - [`PositionAlignment`][pa]
53+
### at: [`Alignment`][alignment]
5454

5555
The location on the `anchor` to position against
5656

57-
### `anchor` - `HTMLElement` OR `MouseEvent`
57+
### anchor: `HTMLElement` OR `MouseEvent`
5858

5959
The element or mouse event to anchor our target to
6060

61-
### `target` - `HTMLElement`
61+
### target: `HTMLElement`
6262

6363
The target that we're going to be positioning
6464

65-
### `collision?` - [`PositionCollision`][pc]
66-
67-
How to handle collisions with the window edge
65+
### collision?: [`CollisionHandler`][cH]
6866

67+
How to handle collisions with the window edge
6968
**Default:** `bestFit`
7069

71-
### `bestFitPreference?` - `horizontal` OR `vertical`
72-
73-
This is the preferred "best" direction when `collision = bestFit` and there is a "best fit" horizontally and vertically
70+
### bestFitPreference?: `horizontal` OR `vertical`
7471

72+
This is the preferred "best" direction when `collision = bestFit` and there is a "best fit" horizontally and vertically
7573
**Default:** `horizontal`
7674

77-
### `defaults?` - `{ my, at }`
78-
79-
The fallback when only one property is supplied or the property supplied is invalid
75+
### defaults?: `{ my: `[`alignment`][alignment]`, at: `[`alignment`][alignment]` }`
8076

77+
The fallback values when only one property is supplied, or the property supplied is invalid
8178
**Default:** `{ my: "top center", at: "bottom center" }`
8279

8380
## Types
8481

85-
### The `PositionAlignment` type
82+
### The `Alignment` type
83+
84+
The `Alignment` will allow any of the below, plus a combination in the form `vertical horizontal` (e.g. `top center`, `bottom right` or `center left`)
8685

87-
The `PositionAlignment` will allow any of the below, plus a combination in the form `vertical horizontal` (e.g. `top center`, `bottom right` or `center left`)
86+
- `top`
87+
- `bottom`
88+
- `center`
89+
- `left`
90+
- `right`
8891

89-
- "top"
90-
- "bottom"
91-
- "center"
92-
- "left"
93-
- "right"
92+
Using a single value will default the other to `center` so `left` == `center left`
9493

95-
### The `PositionCollision` type
94+
### The `CollisionHandler` type
9695

9796
- `bestFit`
9897
- This will find the closest fit before trying to flip the element
@@ -101,5 +100,5 @@ The `PositionAlignment` will allow any of the below, plus a combination in the f
101100
- `ignore`
102101
- This will just ignore any collisions and place the element exactly where you wanted it
103102

104-
[pa]: #The-PositionAlignment-type
105-
[pc]: #The-PositionCollision-type
103+
[alignment]: #the-alignment-type
104+
[cH]: #the-collisionhandler-type

0 commit comments

Comments
 (0)