@invision-www/scroll-to
Advanced tools
Comparing version 1.0.8-y.0 to 1.0.8
@@ -1,18 +0,11 @@ | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b():'function'==typeof define&&define.amd?define(b):a['C:wwwinvisioncobalt-modulespackagesscroll-to']=b()})(this,function(){'use strict';function a(a,b){return b={exports:{}},a(b,b.exports),b.exports}/** | ||
* ScrollTo | ||
* Smoothly animate the scroll of the window. | ||
* | ||
* @param {object} options - Optional configuration | ||
* @param {number} [options.to=0] - The y coordinate to scroll the top of the window to | ||
* @param {number} [options.speed=650] - The speed in which to scroll the window | ||
* @param {string} [options.easing=sineOut] - The timing function used for the animation | ||
* @param {function} [options.handleStart=] - Callback invoked when window starts scrolling | ||
* @param {function} [options.handleEnd=] - Callback invoked when window stops scrolling | ||
*/function b(a){if('undefined'!=typeof window){var b=0,c=window.scrollY||document.documentElement.scrollTop,d=a.to||0,e=a.speed||650,f=a.easing||'sineOut',g=function g(){b+=1/60;var h=b/(e/1e3),i=w[f](h);1>h?(s(g),window.scrollTo(0,c+(d-c)*i)):(window.isScrolling=!1,window.scrollTo(0,d),'handleEnd'in a&&a.handleEnd())};'handleStart'in a&&a.handleStart(),window.isScrolling=!0,s(g)}}for(var c=Math.cos,d=Math.sin,e=Math.PI,f=Math.pow,g=Math.sqrt,h='undefined'==typeof window?'undefined'==typeof global?'undefined'==typeof self?{}:self:global:window,j=a(function(a){(function(){var b,c,d,e,f,g;'undefined'!=typeof performance&&null!==performance&&performance.now?a.exports=function(){return performance.now()}:'undefined'!=typeof process&&null!==process&&process.hrtime?(a.exports=function(){return(b()-f)/1e6},c=process.hrtime,b=function(){var a;return a=c(),1e9*a[0]+a[1]},e=b(),g=1e9*process.uptime(),f=e-g):Date.now?(a.exports=function(){return Date.now()-d},d=Date.now()):(a.exports=function(){return new Date().getTime()-d},d=new Date().getTime())}).call(h)}),k='undefined'==typeof window?h:window,l=['moz','webkit'],m='AnimationFrame',n=k['request'+m],o=k['cancel'+m]||k['cancelRequest'+m],p=0;!n&&p<l.length;p++)n=k[l[p]+'Request'+m],o=k[l[p]+'Cancel'+m]||k[l[p]+'CancelRequest'+m];// Some versions of FF have rAF but not cAF | ||
if(!n||!o){var q=0,i=0,r=[];n=function(a){if(0===r.length){var b=j(),c=Math.max(0,1e3/60-(b-q));q=c+b,setTimeout(function(){var a=r.slice(0);// Clear queue here to prevent | ||
// callbacks from appending listeners | ||
// to the current frame's queue | ||
r.length=0;for(var b=0;b<a.length;b++)if(!a[b].cancelled)try{a[b].callback(q)}catch(a){setTimeout(function(){throw a},0)}},Math.round(c))}return r.push({handle:++i,callback:a,cancelled:!1}),i},o=function(a){for(var b=0;b<r.length;b++)r[b].handle===a&&(r[b].cancelled=!0)}}var s=function(a){// Wrap in a new function to prevent | ||
// `cancel` potentially being assigned | ||
// to the native rAF function | ||
return n.call(k,a)},t=function(){o.apply(k,arguments)},u=function(a){a||(a=k),a.requestAnimationFrame=n,a.cancelAnimationFrame=o};s.cancel=t,s.polyfill=u;var v=function(a){var b=a*a;return a<4/11?7.5625*b:a<8/11?9.075*b-9.9*a+3.4:a<9/10?4356/361*b-35442/1805*a+16061/1805:10.8*a*a-20.52*a+10.72},w={backInOut:function(a){var b=1.525*1.70158;return 1>(a*=2)?.5*(a*a*((b+1)*a-b)):.5*((a-=2)*a*((b+1)*a+b)+2)},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){var b=1.70158;return--a*a*((b+1)*a+b)+1},bounceInOut:function(a){return .5>a?.5*(1-v(1-2*a)):.5*v(2*a-1)+.5},bounceIn:function(a){return 1-v(1-a)},bounceOut:v,circInOut:function(a){return 1>(a*=2)?-.5*(g(1-a*a)-1):.5*(g(1-(a-=2)*a)+1)},circIn:function(a){return 1-g(1-a*a)},circOut:function(a){return g(1- --a*a)},cubicInOut:function(a){return .5>a?4*a*a*a:.5*f(2*a-2,3)+1},cubicIn:function(a){return a*a*a},cubicOut:function(a){var b=a-1;return b*b*b+1},elasticInOut:function(a){return .5>a?.5*d(2*(13*e/2)*a)*f(2,10*(2*a-1)):.5*d(-13*e/2*(2*a-1+1))*f(2,-10*(2*a-1))+1},elasticIn:function(a){return d(13*a*e/2)*f(2,10*(a-1))},elasticOut:function(a){return d(-13*(a+1)*e/2)*f(2,-10*a)+1},expoInOut:function(a){return 0===a||1===a?a:.5>a?+.5*f(2,20*a-10):-.5*f(2,10-20*a)+1},expoIn:function(a){return 0===a?a:f(2,10*(a-1))},expoOut:function(a){return 1===a?a:1-f(2,-10*a)},linear:function(a){return a},quadInOut:function(a){return(a/=.5,1>a)?.5*a*a:(a--,-.5*(a*(a-2)-1))},quadIn:function(a){return a*a},quadOut:function(a){return-a*(a-2)},quartInOut:function(a){return .5>a?8*f(a,4):-8*f(a-1,4)+1},quartIn:function(a){return f(a,4)},quartOut:function(a){return f(a-1,3)*(1-a)+1},quintInOut:function(a){return 1>(a*=2)?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)},quintIn:function(a){return a*a*a*a*a},quintOut:function(a){return--a*a*a*a*a+1},sineInOut:function(a){return-.5*(c(e*a)-1)},sineIn:function(a){var b=c(.5*(a*e));return 1e-14>Math.abs(b)?1:1-b},sineOut:function(a){return d(a*e/2)}};return b}); | ||
'use strict';function _interopDefault(a){return a&&'object'==typeof a&&'default'in a?a['default']:a}var raf=_interopDefault(require('raf')),eases=_interopDefault(require('eases'));/** | ||
* ScrollTo | ||
* Smoothly animate the scroll of the window. | ||
* | ||
* @param {object} options - Optional configuration | ||
* @param {number} [options.to=0] - The y coordinate to scroll the top of the window to | ||
* @param {number} [options.speed=650] - The speed in which to scroll the window | ||
* @param {string} [options.easing=sineOut] - The timing function used for the animation | ||
* @param {function} [options.handleStart=] - Callback invoked when window starts scrolling | ||
* @param {function} [options.handleEnd=] - Callback invoked when window stops scrolling | ||
*/function scrollTo(a){if('undefined'!=typeof window){var b=0,c=window.scrollY||document.documentElement.scrollTop,d=a.to||0,e=a.speed||650,f=a.easing||'sineOut',g=function g(){b+=1/60;var h=b/(e/1e3),i=eases[f](h);1>h?(raf(g),window.scrollTo(0,c+(d-c)*i)):(window.isScrolling=!1,window.scrollTo(0,d),'handleEnd'in a&&a.handleEnd())};'handleStart'in a&&a.handleStart(),window.isScrolling=!0,raf(g)}}module.exports=scrollTo; |
{ | ||
"name": "@invision-www/scroll-to", | ||
"version": "1.0.8-y.0", | ||
"version": "1.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "build/scrollTo.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
0
6716
153