From 9e167b660380017f1f71d338b35261b67e93396b Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 27 Mar 2014 12:37:15 +0100 Subject: [PATCH] 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) --- assets/scripts/app/tailing.coffee | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/assets/scripts/app/tailing.coffee b/assets/scripts/app/tailing.coffee index e88f1424..d85ae12f 100644 --- a/assets/scripts/app/tailing.coffee +++ b/assets/scripts/app/tailing.coffee @@ -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)