Calculate position of #tail element rather than setting position fixed

This change ought to be commited along with 535a873, but due to a bit of
chaos with reverts and merging it's not in the master branch. This fixes
a position calculation of #tail element on the log to work even with
right sidebar (which is a problem on Travis Pro)
This commit is contained in:
Piotr Sarnacki 2014-03-27 12:37:15 +01:00
parent 284baa1ac8
commit 9e167b6603

View File

@ -81,16 +81,12 @@ class @Travis.Tailing
@position = position
positionButton: ->
return if @tail().length is 0
offset = @window.scrollTop() - @log().offset().top
max = @log().height() - @tail().height() + 5
if offset > 0 && offset <= max
@tail().removeClass('bottom')
@tail().addClass('scrolling')
tail = $('#tail')
return if tail.length is 0
offset = $(window).scrollTop() - $('#log').offset().top
max = $('#log').height() - $('#tail').height() + 5
offset = max if offset > max
if offset > 0
tail.css(top: offset - 2)
else
if offset > max
@tail().addClass('bottom')
else
@tail().removeClass('bottom')
@tail().removeClass('scrolling')
tail.css(top: 0)