From: g.chanaud Date: Sat, 30 Apr 2016 15:07:18 +0000 (+0200) Subject: [Bugfix] Sticky : Calculate height before anchors to have correct offset in cas of... X-Git-Tag: v6.2.2-rc1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=027c2daac00510f54ccc31c0038d4ec3d5fa1207;p=thirdparty%2Ffoundation%2Ffoundation-sites.git [Bugfix] Sticky : Calculate height before anchors to have correct offset in cas of non-fixed height sticky element --- diff --git a/js/foundation.sticky.js b/js/foundation.sticky.js index cfe356ffc..9724424e6 100644 --- a/js/foundation.sticky.js +++ b/js/foundation.sticky.js @@ -47,6 +47,10 @@ class Sticky { this.scrollCount = this.options.checkEvery; this.isStuck = false; $(window).one('load.zf.sticky', function(){ + //We calculate the container height to have correct values for anchor points offset calculation. + _this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height; + _this.$container.css('height', _this.containerHeight); + _this.elemHeight = _this.containerHeight; if(_this.options.anchor !== ''){ _this.$anchor = $('#' + _this.options.anchor); }else{