ngx-scroll-event
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "ngx-scroll-event", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "An Angular 2+ directive to handle scroll events on an element.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -37,3 +37,3 @@ # ngx-scroll-event | ||
In your template you may now add the `detect-scroll` attribute and `(onScroll)` event to any element. | ||
you can also add `[bottomOffest]` to change when reaching bottom is alert is true, defaults to 100, the value should be a number in pixels. | ||
you can also add `[bottomOffset]` to change when reaching bottom is alert is true, defaults to 100, the value should be a number in pixels. | ||
@@ -50,3 +50,3 @@ ```typescript | ||
template: `... | ||
<div detect-scroll (onScroll)="handleScroll($event)" [bottomOffest]="200"> | ||
<div detect-scroll (onScroll)="handleScroll($event)" [bottomOffset]="200"> | ||
<div>Bla bla bla</div> | ||
@@ -53,0 +53,0 @@ <div>Bla bla bla</div> |
@@ -9,3 +9,3 @@ import { EventEmitter } from '@angular/core'; | ||
onScroll: EventEmitter<ScrollEvent>; | ||
bottomOffest: number; | ||
bottomOffset: number; | ||
constructor(); | ||
@@ -12,0 +12,0 @@ scrolled($event: Event): void; |
@@ -13,6 +13,6 @@ "use strict"; | ||
var core_1 = require("@angular/core"); | ||
var ScrollDirective = (function () { | ||
var ScrollDirective = /** @class */ (function () { | ||
function ScrollDirective() { | ||
this.onScroll = new core_1.EventEmitter(); | ||
this.bottomOffest = 100; | ||
this.bottomOffset = 100; | ||
} | ||
@@ -30,3 +30,3 @@ // handle host scroll | ||
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; | ||
var isReachingBottom = (target.body.offsetHeight - (window.innerHeight + scrollTop)) < this.bottomOffest; | ||
var isReachingBottom = (target.body.offsetHeight - (window.innerHeight + scrollTop)) < this.bottomOffset; | ||
var emitValue = { isReachingBottom: isReachingBottom, originalEvent: $event, isWindowEvent: true }; | ||
@@ -39,3 +39,3 @@ this.onScroll.emit(emitValue); | ||
var offsetHeight = target.offsetHeight; | ||
var isReachingBottom = (scrollPosition - offsetHeight) < this.bottomOffest; | ||
var isReachingBottom = (scrollPosition - offsetHeight) < this.bottomOffset; | ||
var emitValue = { isReachingBottom: isReachingBottom, originalEvent: $event, isWindowEvent: false }; | ||
@@ -51,3 +51,3 @@ this.onScroll.emit(emitValue); | ||
__metadata("design:type", Number) | ||
], ScrollDirective.prototype, "bottomOffest", void 0); | ||
], ScrollDirective.prototype, "bottomOffset", void 0); | ||
__decorate([ | ||
@@ -54,0 +54,0 @@ core_1.HostListener('scroll', ['$event']), |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"ScrollDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[detect-scroll]"}]}],"members":{"onScroll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"bottomOffest":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor"}],"scrolled":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["scroll",["$event"]]}]}],"windowScrolled":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["window:scroll",["$event"]]}]}],"windowScrollEvent":[{"__symbolic":"method"}],"elementScrollEvent":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"ScrollDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[detect-scroll]"}]}],"members":{"onScroll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"bottomOffest":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor"}],"scrolled":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["scroll",["$event"]]}]}],"windowScrolled":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["window:scroll",["$event"]]}]}],"windowScrollEvent":[{"__symbolic":"method"}],"elementScrollEvent":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"ScrollDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[detect-scroll]"}]}],"members":{"onScroll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"bottomOffset":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor"}],"scrolled":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["scroll",["$event"]]}]}],"windowScrolled":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["window:scroll",["$event"]]}]}],"windowScrollEvent":[{"__symbolic":"method"}],"elementScrollEvent":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"ScrollDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[detect-scroll]"}]}],"members":{"onScroll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"bottomOffset":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor"}],"scrolled":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["scroll",["$event"]]}]}],"windowScrolled":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["window:scroll",["$event"]]}]}],"windowScrollEvent":[{"__symbolic":"method"}],"elementScrollEvent":[{"__symbolic":"method"}]}}}}] |
@@ -12,3 +12,3 @@ "use strict"; | ||
var scroll_directive_1 = require("./scroll.directive"); | ||
var ScrollEventModule = (function () { | ||
var ScrollEventModule = /** @class */ (function () { | ||
function ScrollEventModule() { | ||
@@ -15,0 +15,0 @@ } |
Sorry, the diff of this file is not supported yet
44845