Skip to content

Commit

Permalink
2.1.0
Browse files Browse the repository at this point in the history
You can now disable automatic smoothing of local links by setting
window.noZensmooth to a non-falsy value.
  • Loading branch information
zengabor committed Jan 15, 2016
1 parent e9eb46e commit 960576c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Smooth animated scrolling. No more abrupt jumps.
Move elements into view, to the center, or scroll to any vertical position.

*864 bytes of pure JavaScript. No dependencies.*
*875 bytes of pure JavaScript. No dependencies.*


## About
Expand All @@ -28,7 +28,7 @@ Features:
- Scroll to an element while centering it on the screen.
- Customize the duration.
- Specify the spacing between the element and the edge of the screen (required for fixed navigation bars and footers).
- Only 864 bytes minimized & gzipped.
- Only 875 bytes minimized & gzipped.
- No dependencies.

Full support tested and works under:
Expand Down Expand Up @@ -67,6 +67,16 @@ You can also use npm to get Zenscroll:
npm install zenscroll
````

If you want to use Zenscroll programmatically but you don’t need the automatic smoothing on local links then set `window.noZensmooth` to a non-falsy value. In this case the event handler for automatic smoothing is not installed but you can still use everything, like `zenscroll.intoView()`, etc. For example:

````html
...
<script>window.noZensmooth = true</script>
<script src="zenscroll-min.js"></script>
</body>
````

(I consider this a rare scenario that’s why I keep the default behavior of installing the event handler.)
## How to use


Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zenscroll",
"version": "2.0.0",
"description": "A module to smooth-scroll web pages and inside elements",
"version": "2.1.0",
"description": "A module to smooth-scroll web pages and DIVs",
"main": "zenscroll.js",
"files": ["zenscroll.js", "zenscroll-min.js"],
"homepage": "https://zengabor.github.io/zenscroll/",
Expand Down
2 changes: 1 addition & 1 deletion zenscroll-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion zenscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
}

// create listeners for the documentElement only & exclude IE8-
if (!scrollContainer && "addEventListener" in win) {
if (!scrollContainer && "addEventListener" in win && !win.noZensmooth) {
win.addEventListener("click", internalLinkHandler, false)
}

Expand Down

0 comments on commit 960576c

Please sign in to comment.