Permalink
Browse files

Fix fixing element whose box-sizing is border-box

Signed-off-by: Jack Cherng <jfcherng@gmail.com>
  • Loading branch information...
jfcherng committed Sep 19, 2018
1 parent e428c0a commit 55051146f45c1084ad8ecb7469f1e56ecb2c2844
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/scrollfix.js
View
@@ -110,7 +110,7 @@ var Shira;
if (this.options.styleSubstitute) {
$substitute
.css('visibility', 'hidden')
.height($(this.element).height());
.height($element.css('box-sizing') === 'border-box' ? $element.outerHeight() : $element.height());
}
this.substitute = $substitute.insertAfter(this.element)[0];
@@ -130,7 +130,7 @@ var Shira;
// add class
$element.addClass(side === 'top' ? this.options.topFixClass : this.options.bottomFixClass);
// update state
this.fixed = true;
this.fixedAt = side;
@@ -193,7 +193,7 @@ var Shira;
$(this.element)
.css(cssReset)
.removeClass(this.fixedAt === 'top' ? this.options.topFixClass : this.options.bottomFixClass);
// update state
this.fixed = false;
this.fixedAt = null;

0 comments on commit 5505114

Please sign in to comment.