Skip to content
Snippets Groups Projects
Commit 87fe9474 authored by Jared Hancock's avatar Jared Hancock
Browse files

Scroll to most-recent thread entry

parent 1221fcf0
Branches
Tags
No related merge requests found
...@@ -450,13 +450,13 @@ var scp_prep = function() { ...@@ -450,13 +450,13 @@ var scp_prep = function() {
stop = $('div.sticky.bar.stop'), stop = $('div.sticky.bar.stop'),
stopAt, stopAt,
visible = false; visible = false;
if (stop.length)
stopAt = stop.offset().top - $that.height();
$that.find('.content').width($that.width()); $that.find('.content').width($that.width());
$(window).scroll(function (event) { $(window).scroll(function (event) {
// what the y position of the scroll is // what the y position of the scroll is
var y = $(this).scrollTop(); var y = $(this).scrollTop();
if (stop.length)
stopAt = stop.offset().top - $that.height();
// whether that's below the form // whether that's below the form
if (y >= top && (!stopAt || stopAt > y)) { if (y >= top && (!stopAt || stopAt > y)) {
......
...@@ -343,6 +343,9 @@ $.refreshTicketView = function() { ...@@ -343,6 +343,9 @@ $.refreshTicketView = function() {
} }
var ticket_onload = function($) { var ticket_onload = function($) {
if (0 === $('#ticket_thread').length)
return;
//Start watching the form for activity. //Start watching the form for activity.
autoLock.Init(); autoLock.Init();
...@@ -422,6 +425,11 @@ var ticket_onload = function($) { ...@@ -422,6 +425,11 @@ var ticket_onload = function($) {
}); });
$.showImagesInline($('#ticket_thread').data('imageUrls')); $.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); $(ticket_onload);
$(document).on('pjax:success', function() { ticket_onload(jQuery); }); $(document).on('pjax:success', function() { ticket_onload(jQuery); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment