From a4668c45d84e2c371d6cc155944cde6384303e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 4 Oct 2016 16:11:19 +0200 Subject: [PATCH] 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. --- src/scripts/tutti/10_tasks.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/scripts/tutti/10_tasks.js b/src/scripts/tutti/10_tasks.js index 6bdc4e5..e952ec4 100644 --- a/src/scripts/tutti/10_tasks.js +++ b/src/scripts/tutti/10_tasks.js @@ -26,6 +26,10 @@ function item_open(item_id, item_type, pushState) 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'); // Style elements starting with item_type and dash, e.g. "#shot-uuid" @@ -346,10 +350,6 @@ $(function() { // rather than the thing we clicked on. var shot_id = e.delegateTarget.dataset.shotId; shot_open(shot_id); - - if ($(window).scrollTop() > 100) { - $("html, body").animate({scrollTop: 50 }, '500', 'swing'); - } }); $("a.task-link[data-task-id]").click(function(e) { @@ -361,9 +361,5 @@ $(function() { $('[id^="shot-"]').removeClass('active'); $(this).parent().parent().addClass('active'); } - - if ($(window).scrollTop() > 100) { - $("html, body").animate({scrollTop: 50 }, '500', 'swing'); - } }); });