Use outerheight when calculating position to take padding into account

This commit is contained in:
Piotr Sarnacki 2014-03-04 15:34:06 +01:00
parent 0ef732557c
commit 10271e2915

View File

@ -21,13 +21,13 @@ class Travis.ToTop
element = @element() element = @element()
container = @container() container = @container()
return if element.length is 0 return if element.length is 0
containerHeight = container.height() containerHeight = container.outerHeight()
windowHeight = @window.height() windowHeight = @window.height()
offset = container.offset().top + containerHeight - (@window.scrollTop() + windowHeight) offset = container.offset().top + containerHeight - (@window.scrollTop() + windowHeight)
max = containerHeight - windowHeight max = containerHeight - windowHeight
offset = max if offset > max offset = max if offset > max
if offset > 0 if offset > 0
element.css(bottom: offset) element.css(bottom: offset + 4)
else else
element.css(bottom: 2) element.css(bottom: 2)