diff --git a/scp/js/scp.js b/scp/js/scp.js index 496b724c6d3e0ca5e5b8a690974871bb9934ac42..d1c73fc8bf47f33a938b5194803683a234a90534 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -450,13 +450,13 @@ var scp_prep = function() { stop = $('div.sticky.bar.stop'), stopAt, visible = false; - if (stop.length) - stopAt = stop.offset().top - $that.height(); $that.find('.content').width($that.width()); $(window).scroll(function (event) { // what the y position of the scroll is var y = $(this).scrollTop(); + if (stop.length) + stopAt = stop.offset().top - $that.height(); // whether that's below the form if (y >= top && (!stopAt || stopAt > y)) { diff --git a/scp/js/ticket.js b/scp/js/ticket.js index c5c8df2025938307c5e9e79eccfe2d183f995799..9e731a756fccbb9bb3e889833901ad456a406659 100644 --- a/scp/js/ticket.js +++ b/scp/js/ticket.js @@ -343,6 +343,9 @@ $.refreshTicketView = function() { } var ticket_onload = function($) { + if (0 === $('#ticket_thread').length) + return; + //Start watching the form for activity. autoLock.Init(); @@ -422,6 +425,11 @@ var ticket_onload = function($) { }); $.showImagesInline($('#ticket_thread').data('imageUrls')); + + var last_entry = $('#ticket_thread .thread-entry').last().offset().top - 50; + $('html, body').animate({ + scrollTop: last_entry + }, 1000); }; $(ticket_onload); $(document).on('pjax:success', function() { ticket_onload(jQuery); });