You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-9Lines changed: 32 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,22 +22,31 @@ There are two versions of Smooth Scroll: the standalone version, and one that co
22
22
23
23
If you're including your own polyfills or don't want to enable this feature for older browsers, use the standalone version. Otherwise, use the version with polyfills.
24
24
25
-
**Direct `<script>` include**
25
+
**Direct Download**
26
26
27
-
[Download the files directly](https://github.com/cferdinandi/smooth-scroll/archive/master.zip) or use the [jsDelivr CDN](https://cdn.jsdelivr.net/gh/cferdinandi/smooth-scroll/dist/).
27
+
You can [download the files directly from GitHub](https://github.com/cferdinandi/smooth-scroll/archive/master.zip).
You can also use the [jsDelivr CDN](https://cdn.jsdelivr.net/gh/cferdinandi/smooth-scroll/dist/). I recommend linking to a specific version number or version range to prevent major updates from breaking your site. Smooth Scroll uses semantic versioning.
@@ -65,6 +74,20 @@ In the footer of your page, after the content, initialize Smooth Scroll by passi
65
74
***Note:****The `a[href*="#"]` selector will apply Smooth Scroll to all anchor links. You can selectively target links using any other selector(s) you'd like. Smooth Scroll accepts multiple selectors as a comma separated list. Example: `'.js-scroll, [data-scroll], #some-link'`.*
66
75
67
76
77
+
## ES6 Modules
78
+
79
+
Smooth Scroll does not have a default export, but does support CommonJS and can be used with native ES6 module imports.
80
+
81
+
```js
82
+
import('/path/to/smooth-scroll.polyfills.min.js')
83
+
.then(function () {
84
+
var scroll =newSmoothScroll('a[href*="#"]');
85
+
});
86
+
```
87
+
88
+
It uses a UMD pattern, and should also work in most major module bundlers and package managers.
0 commit comments