Skip to content

Commit 467e99e

Browse files
committed
more README updates
1 parent b0cb32d commit 467e99e

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

README.md

+19-21
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ import jump from 'jump.js'
3737

3838
### Call
3939

40-
Jump exports a _singleton_, so there's no need to create an instance. Just call it, passing in a [target](#target).
40+
Jump exports a _singleton_, so there's no need to create an instance. Just call it, passing a [target](#target).
4141

4242
```es6
43-
// call Jump
43+
// call Jump, passing a target
4444

4545
jump('.target')
4646
```
@@ -49,11 +49,9 @@ Note that the singleton can make an infinite number of jumps.
4949

5050
## Options
5151

52-
All options, **except [target](#target)**, are optional, and have sensible defaults. Default options are shown below.
52+
All options, **except [target](#target)**, are optional, and have sensible defaults. The defaults are shown below:
5353

5454
```es6
55-
// default options
56-
5755
jump('.target', {
5856
duration: 1000,
5957
offset: 0,
@@ -86,19 +84,22 @@ jump(100)
8684
jump(-100)
8785
```
8886

89-
Or, scroll _to an element_ by passing a node or a selector.
87+
Or, scroll _to an element_, by passing either:
88+
89+
* a node, or
90+
* a CSS selector
9091

9192
```es6
9293
// passing a node
9394

94-
const node = document.querySelector('#target')
95+
const node = document.querySelector('.target')
9596

9697
jump(node)
9798

98-
// passing a selector
99-
// the element is resolved using document.querySelector
99+
// passing a CSS selector
100+
// the element referenced by the selector is determined using document.querySelector
100101

101-
jump('#target')
102+
jump('.target')
102103
```
103104

104105
### duration
@@ -111,7 +112,7 @@ jump('.target', {
111112
})
112113
```
113114

114-
Or, pass a function accepting `distance` (in `px`) as an argument, that returns the duration of the `jump()`, in milliseconds.
115+
Or, pass a function that returns the duration of the `jump()` in milliseconds. This function is passed the `jump()` `distance`, in `px`, as a parameter.
115116

116117
```es6
117118
jump('.target', {
@@ -137,24 +138,18 @@ jump('.target', {
137138
})
138139
```
139140

140-
Note that this option is useful for accommodating elements `position: fixed` to the top/bottom of the screen.
141+
Note that this option is useful for accommodating `position: fixed` elements.
141142

142143
### callback
143144

144-
Pass a function to be called after the `jump()` has been completed.
145+
Pass a function that will be called after the `jump()` has been completed.
145146

146147
```es6
147-
// in both regular and arrow functions, 'this' === 'window'
148+
// in both regular and arrow functions, this === window
148149

149150
jump('.target', {
150151
callback: () => console.log('Jump completed!')
151152
})
152-
153-
jump('.target', {
154-
callback: function() {
155-
console.log('Jump completed!')
156-
}
157-
})
158153
```
159154

160155
### easing
@@ -171,7 +166,10 @@ See [easing.js](https://github.com/callmecavs/jump.js/blob/master/src/easing.js)
171166

172167
### a11y
173168

174-
If enabled, _and scrolling to an element_, add a [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) to, and [`focus`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus), the element.
169+
If enabled, _and scrolling to an element_:
170+
171+
* add a [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) to, and
172+
* [`focus`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) the element
175173

176174
```es6
177175
jump('.target', {

0 commit comments

Comments
 (0)