Skip to content

Commit f040c54

Browse files
committed
Update readme
1 parent e73a51d commit f040c54

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

readme.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ The following options, shown with their default values, are available for both `
5050
// only use if you want to override default behavior or if using $.smoothScroll
5151
scrollTarget: null,
5252

53-
// automatically focus the target element after scrolling to it (see readme for details)
53+
// automatically focus the target element after scrolling to it
54+
// (see https://github.com/kswedberg/jquery-smooth-scroll#focus-element-after-scrolling-to-it for details)
5455
autoFocus: false,
5556

5657
// string to use as selector for event delegation
@@ -186,11 +187,16 @@ if (reSmooth.test(location.hash)) {
186187
}
187188
```
188189

189-
## Focus element after scrolling to it.
190+
### Focus element after scrolling to it.
190191

191192
Imagine you have a link to a form somewhere on the same page. When the user clicks the link, you want the user to be able to begin interacting with that form.
192193

193194
* As of **smoothScroll version 2.2**, the plugin will automatically focus the element if you set the `autoFocus` option to `true`.
195+
```js
196+
$('div.example').smoothScroll({
197+
autoFocus: true
198+
});
199+
```
194200
* In the future, versions 3.x and later will have `autoFocus` set to true **by default**.
195201
* If you are using the low-level `$.smoothScroll` method, `autoFocus` will only work if you've also provided a value for the `scrollTarget` option.
196202
* Prior to version 2.2, you can use the `afterScroll` callback function. Here is an example that focuses the first input within the form after scrolling to the form:

0 commit comments

Comments
 (0)