]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Ensure that unstuck classes are set on load 9366/head
authorJérôme Lebleu <jerome@maroufle.fr>
Sat, 12 Nov 2016 15:31:28 +0000 (16:31 +0100)
committerJérôme Lebleu <jerome@maroufle.fr>
Sat, 12 Nov 2016 15:31:28 +0000 (16:31 +0100)
js/foundation.sticky.js

index 86e39159c6b231632b7b19780b41c662f30778e7..39c0e707af97705bfc93076fab91b706cf9cad32 100644 (file)
@@ -58,7 +58,12 @@ class Sticky {
       }
 
       _this._setSizes(function(){
-        _this._calc(false);
+        var scroll = window.pageYOffset;
+        _this._calc(false, scroll);
+        //Unstick the element will ensure that proper classes are set.
+        if (!_this.isStuck) {
+          _this._removeSticky((scroll >= _this.topPoint) ? false : true);
+        }
       });
       _this._events(id.split('-').reverse().join('-'));
     });