]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
[Bugfix] Sticky : Calculate height before anchors to have correct offset in cas of... 8717/head
authorg.chanaud <g.chanaud@regence-production.ch>
Sat, 30 Apr 2016 15:07:18 +0000 (17:07 +0200)
committerg.chanaud <g.chanaud@regence-production.ch>
Sat, 30 Apr 2016 15:07:18 +0000 (17:07 +0200)
js/foundation.sticky.js

index cfe356ffc219b722731831a803fe0d95f68701f9..9724424e6b75d47c7279d06c8db0c4ddc9812da3 100644 (file)
@@ -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{