Skip to content

Commit 940e751

Browse files
committed
Merge pull request #8717 from gehasia/sticky-fluidheightoffset-fix
[Bugfix] Sticky : Set container height before positioning anchors
2 parents 3853dce + 027c2da commit 940e751

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

js/foundation.sticky.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ class Sticky {
4747
this.scrollCount = this.options.checkEvery;
4848
this.isStuck = false;
4949
$(window).one('load.zf.sticky', function(){
50+
//We calculate the container height to have correct values for anchor points offset calculation.
51+
_this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height;
52+
_this.$container.css('height', _this.containerHeight);
53+
_this.elemHeight = _this.containerHeight;
5054
if(_this.options.anchor !== ''){
5155
_this.$anchor = $('#' + _this.options.anchor);
5256
}else{

0 commit comments

Comments
 (0)