diff --git a/src/layzr.js b/src/layzr.js index a72ab16..f022b74 100644 --- a/src/layzr.js +++ b/src/layzr.js @@ -32,6 +32,7 @@ export default (options = {}) => { const instance = knot({ handlers: handlers, + handlersFor: handlersFor, check: check, update: update }) @@ -110,6 +111,15 @@ export default (options = {}) => { ;['scroll', 'resize'].forEach(event => window[action](event, requestScroll)) return this } + + function handlersFor(node, flag) { + const action = flag + ? 'addEventListener' + : 'removeEventListener' + + ;node[action]('scroll', requestFrame)) + return this + } function check() { windowHeight = window.innerHeight