Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zenscroll

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zenscroll - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

4

package.json
{
"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",

@@ -6,0 +6,0 @@ "files": ["zenscroll.js", "zenscroll-min.js"],

@@ -16,3 +16,3 @@ <p align="center">

*864 bytes of pure JavaScript. No&nbsp;dependencies.*
*875 bytes of pure JavaScript. No&nbsp;dependencies.*

@@ -32,3 +32,3 @@

- 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.

@@ -72,2 +72,12 @@

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&nbsp;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

@@ -74,0 +84,0 @@

@@ -1,1 +0,1 @@

!function(t,e){"use strict";t.Zenscroll=function n(o,i,r){i=i||999,r&&0===r||(r=9);var c,l=e.documentElement,a=function(){return o?o.scrollTop:t.scrollY||l.scrollTop},u=function(){return o?Math.min(o.offsetHeight,t.innerHeight):t.innerHeight||l.clientHeight},f=function(t){return o?t.offsetTop-o.offsetTop:t.getBoundingClientRect().top+a()-l.offsetTop},s=function M(){clearTimeout(c),c=0},h=function(e,n){s();var r=a(),f=Math.max(e,0)-r;n=n||Math.min(Math.abs(f),i);var h=(new Date).getTime();!function g(){c=setTimeout(function(){var e=Math.min(((new Date).getTime()-h)/n,1),i=Math.max(Math.floor(r+f*(.5>e?2*e*e:e*(4-2*e)-1)),0);o?o.scrollTop=i:t.scrollTo(0,i),1>e&&u()+i<(o||l).scrollHeight?g():setTimeout(s,99)},9)}()},g=function H(t,e){h(f(t)-r,e)},m=function w(t,e){var n=t.getBoundingClientRect().height+2*r,o=u(),i=f(t),c=i+n,l=a();r>i-l||n>o?g(t,e):r>l+o-c&&h(c-o,e)},p=function x(t,e,n){h(Math.max(f(t)-u()/2+(n||t.getBoundingClientRect().height/2),0),e)},v=function B(e){try{history.replaceState({},"",t.location.href.split("#")[0]+(e?"#"+e:""))}catch(n){}},d=function D(e){for(var n=e.target;n&&"A"!==n.tagName;)n=n.parentNode;if(n){var o=n.getAttribute("href")||"";if(0===o.indexOf("#"))if("#"===o)e.preventDefault(),t.zenscroll.toY(0),v("");else{var i=n.hash.substring(1),r=document.getElementById(i);r&&(e.preventDefault(),t.zenscroll.to(r),v(i))}}};!o&&"addEventListener"in t&&t.addEventListener("click",d,!1);var T=function E(t,e){t&&(i=t),null!==e&&(r=e)};return{setup:T,to:g,toY:h,intoView:m,center:p,stop:s,moving:function(){return!!c}}},t.zenscroll=new t.Zenscroll}(this,document);
!function(t,e){"use strict";t.Zenscroll=function n(o,i,r){i=i||999,r&&0===r||(r=9);var c,l=e.documentElement,a=function(){return o?o.scrollTop:t.scrollY||l.scrollTop},u=function(){return o?Math.min(o.offsetHeight,t.innerHeight):t.innerHeight||l.clientHeight},f=function(t){return o?t.offsetTop-o.offsetTop:t.getBoundingClientRect().top+a()-l.offsetTop},s=function M(){clearTimeout(c),c=0},h=function(e,n){s();var r=a(),f=Math.max(e,0)-r;n=n||Math.min(Math.abs(f),i);var h=(new Date).getTime();!function g(){c=setTimeout(function(){var e=Math.min(((new Date).getTime()-h)/n,1),i=Math.max(Math.floor(r+f*(.5>e?2*e*e:e*(4-2*e)-1)),0);o?o.scrollTop=i:t.scrollTo(0,i),1>e&&u()+i<(o||l).scrollHeight?g():setTimeout(s,99)},9)}()},g=function H(t,e){h(f(t)-r,e)},m=function w(t,e){var n=t.getBoundingClientRect().height+2*r,o=u(),i=f(t),c=i+n,l=a();r>i-l||n>o?g(t,e):r>l+o-c&&h(c-o,e)},p=function x(t,e,n){h(Math.max(f(t)-u()/2+(n||t.getBoundingClientRect().height/2),0),e)},v=function B(e){try{history.replaceState({},"",t.location.href.split("#")[0]+(e?"#"+e:""))}catch(n){}},d=function D(e){for(var n=e.target;n&&"A"!==n.tagName;)n=n.parentNode;if(n){var o=n.getAttribute("href")||"";if(0===o.indexOf("#"))if("#"===o)e.preventDefault(),t.zenscroll.toY(0),v("");else{var i=n.hash.substring(1),r=document.getElementById(i);r&&(e.preventDefault(),t.zenscroll.to(r),v(i))}}};!o&&"addEventListener"in t&&!t.noZensmooth&&t.addEventListener("click",d,!1);var T=function E(t,e){t&&(i=t),null!==e&&(r=e)};return{setup:T,to:g,toY:h,intoView:m,center:p,stop:s,moving:function(){return!!c}}},t.zenscroll=new t.Zenscroll}(this,document);

@@ -193,3 +193,3 @@ /**

// 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)

@@ -196,0 +196,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc