diff --git a/index.js b/index.js index 6ce47c6..9762dc4 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ /*! * Stickyfill -- `position: sticky` polyfill - * v. 1.1.1 | https://github.com/wilddeer/stickyfill + * v. 1.1.3 | https://github.com/wilddeer/stickyfill * Copyright Oleg Korsunsky | http://wd.dizaina.net/ * * MIT License @@ -14,7 +14,7 @@ module.exports = (function(doc, win) { if (!win) { win = window; } - + var watchArray = [], scroll, initialized = false, @@ -59,7 +59,7 @@ module.exports = (function(doc, win) { } function mergeObjects(targetObj, sourceObject) { - for (key in sourceObject) { + for (var key in sourceObject) { if (sourceObject.hasOwnProperty(key)) { targetObj[key] = sourceObject[key]; } @@ -83,7 +83,7 @@ module.exports = (function(doc, win) { rebuild(); return; } - + if (win.pageYOffset != scroll.top) { updateScrollPos(); recalcAllPos(); @@ -130,7 +130,7 @@ module.exports = (function(doc, win) { } function initElement(el) { - if (isNaN(parseFloat(el.computed.top)) || el.isCell) return; + if (isNaN(parseFloat(el.computed.top)) || el.isCell || el.computed.display == 'none') return; el.inited = true; @@ -256,7 +256,8 @@ module.exports = (function(doc, win) { marginBottom: computedStyle.marginBottom, marginLeft: computedStyle.marginLeft, marginRight: computedStyle.marginRight, - cssFloat: computedStyle.cssFloat + cssFloat: computedStyle.cssFloat, + display: computedStyle.display }, numeric = { top: parseNumeric(computedStyle.top), @@ -282,7 +283,7 @@ module.exports = (function(doc, win) { }, nodeOffset = getElementOffset(node), parentOffset = getElementOffset(parentNode), - + parent = { node: parentNode, css: { @@ -398,11 +399,11 @@ module.exports = (function(doc, win) { if (!initialized) return; deinitAll(); - + for (var i = watchArray.length - 1; i >= 0; i--) { watchArray[i] = getElementParams(watchArray[i].node); } - + initAll(); } @@ -420,7 +421,7 @@ module.exports = (function(doc, win) { function stop() { pause(); - deinitAll(); + deinitAll(); } function kill() {