@beradrian/ngx-auto-scroll
Version:
Angular 2+ directive to automatically scroll html container content to the bottom.
3 lines (2 loc) • 1.79 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],e):e(t["ngx-auto-scroll"]={},t.ng.core)}(this,function(t,e){"use strict";var o=function(){function t(t){this.lockYOffset=10,this.observeAttributes="false",this.isLocked=!1,this.nativeElement=t.nativeElement}return t.prototype.getObserveAttributes=function(){return""!==this.observeAttributes&&"false"!==this.observeAttributes.toLowerCase()},t.prototype.ngAfterContentInit=function(){var t=this;this.mutationObserver=new MutationObserver(function(){t.isLocked||t.scrollDown()}),this.mutationObserver.observe(this.nativeElement,{childList:!0,subtree:!0,attributes:this.getObserveAttributes()})},t.prototype.ngOnDestroy=function(){this.mutationObserver.disconnect()},t.prototype.forceScrollDown=function(){this.scrollDown()},t.prototype.scrollDown=function(){this.nativeElement.scrollTop=this.nativeElement.scrollHeight},t.prototype.scrollHandler=function(){var t=this.nativeElement.scrollHeight-this.nativeElement.scrollTop-this.nativeElement.clientHeight;this.isLocked=t>this.lockYOffset},t}();o.decorators=[{type:e.Directive,args:[{selector:"[ngx-auto-scroll]"}]}],o.ctorParameters=function(){return[{type:e.ElementRef}]},o.propDecorators={lockYOffset:[{type:e.Input,args:["lock-y-offset"]}],observeAttributes:[{type:e.Input,args:["observe-attributes"]}],scrollHandler:[{type:e.HostListener,args:["scroll"]}]};var r=function(){return function(){}}();r.decorators=[{type:e.NgModule,args:[{declarations:[o],imports:[],exports:[o]}]}],r.ctorParameters=function(){return[]},t.NgxAutoScroll=o,t.NgxAutoScrollModule=r,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ngx-auto-scroll.umd.min.js.map