Skip to content

Commit

Permalink
fix recalc for when elements are currently stuck leafo#5
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Sep 11, 2013
1 parent 51c6a40 commit 3ecd704
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
10 changes: 8 additions & 2 deletions jquery.sticky-kit.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ $.fn.stick_in_parent = (opts={}) ->
parent_top = parent.offset().top + border_top + padding_top
parent_height = parent.height()

top = elm.offset().top - parseInt elm.css("margin-top"), 10
height = elm.outerHeight true
sizing_elm = if elm.is ".is_stuck"
spacer
else
elm

top = sizing_elm.offset().top - parseInt sizing_elm.css("margin-top"), 10
height = sizing_elm.outerHeight true

recalc()
return if height == parent_height
Expand All @@ -38,6 +43,7 @@ $.fn.stick_in_parent = (opts={}) ->
width: elm.outerWidth true
height: height
display: elm.css "display"
"vertical-align": elm.css "vertical-align"
float: float
})

Expand Down
8 changes: 5 additions & 3 deletions jquery.sticky-kit.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions jquery.sticky-kit.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions site/www/src/jquery.sticky-kit.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions site/www/src/jquery.sticky-kit.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ecd704

Please sign in to comment.