Scroll all the way to the top when opening a shot/task.

This way the status bar is in view too, which is essential when loading
fails for some reason.
This commit is contained in:
2016-10-04 16:11:19 +02:00
parent b39e3d431d
commit a4668c45d8

View File

@@ -26,6 +26,10 @@ function item_open(item_id, item_type, pushState)
throw new ReferenceError("ProjectUtils.projectUrl() undefined"); throw new ReferenceError("ProjectUtils.projectUrl() undefined");
} }
if ($(window).scrollTop() > 0) {
$("html, body").animate({scrollTop: 0 }, '500', 'swing');
}
$('#col_right .col_header span.header_text').text(item_type + ' details'); $('#col_right .col_header span.header_text').text(item_type + ' details');
// Style elements starting with item_type and dash, e.g. "#shot-uuid" // Style elements starting with item_type and dash, e.g. "#shot-uuid"
@@ -346,10 +350,6 @@ $(function() {
// rather than the thing we clicked on. // rather than the thing we clicked on.
var shot_id = e.delegateTarget.dataset.shotId; var shot_id = e.delegateTarget.dataset.shotId;
shot_open(shot_id); shot_open(shot_id);
if ($(window).scrollTop() > 100) {
$("html, body").animate({scrollTop: 50 }, '500', 'swing');
}
}); });
$("a.task-link[data-task-id]").click(function(e) { $("a.task-link[data-task-id]").click(function(e) {
@@ -361,9 +361,5 @@ $(function() {
$('[id^="shot-"]').removeClass('active'); $('[id^="shot-"]').removeClass('active');
$(this).parent().parent().addClass('active'); $(this).parent().parent().addClass('active');
} }
if ($(window).scrollTop() > 100) {
$("html, body").animate({scrollTop: 50 }, '500', 'swing');
}
}); });
}); });