UNPKG

ng-animate-scroll

Version:

Customizable angular module to animate scroll event to an element. Compatible with Angular 2.x onwards

2 lines 1.35 kB
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("ng-animate-scroll",["exports","@angular/core"],o):o(e["ng-animate-scroll"]={},e.ng.core)}(this,function(e,o){"use strict";var t=function(){function e(){}return e.prototype.scrollToElement=function(e,o,t){void 0===o&&(o=750);var n=document.getElementById(e);if(n){var r=n.offsetTop;t?("string"==typeof t&&(t=document.getElementById(t)),this.scrollTo(t,r,o,!0)):this.scrollTo(window.document,r,o)}else console.error("Could not find element with the following ID: "+e)},e.prototype.scrollTo=function(o,e,t,n){void 0===n&&(n=!1);var r,l,c,i=this,s=0;r=n?o.scrollTop:0<o.body.scrollTop?o.body.scrollTop:0<o.documentElement.scrollTop?o.documentElement.scrollTop:0,l=e-r,(c=function(){s+=20;var e=i.easeInOut(s,r,l,t);n?o.scroll(0,e):top.window.scroll(0,e),s<t&&setTimeout(c,20)})()},e.prototype.easeInOut=function(e,o,t,n){return(e/=n/2)<1?t/2*e*e+o:-t/2*(--e*(e-2)-1)+o},e.decorators=[{type:o.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[]},e.ngInjectableDef=o.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();e.NgAnimateScrollService=t,Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=ng-animate-scroll.umd.min.js.map