From d7fc1e60226ab1ce3a516eb715b28c88a329b840 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sat, 12 Nov 2016 16:31:28 +0100 Subject: [PATCH] Ensure that unstuck classes are set on load --- js/foundation.sticky.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/foundation.sticky.js b/js/foundation.sticky.js index 86e39159c..39c0e707a 100644 --- a/js/foundation.sticky.js +++ b/js/foundation.sticky.js @@ -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('-')); }); -- 2.47.2