From 55aebebadb7fb57bca6671a247ac85726615b5d5 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Thu, 29 Sep 2016 14:29:09 +0200 Subject: [PATCH] Scroll to top after clicking on shots/tasks --- src/scripts/tutti/10_tasks.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/scripts/tutti/10_tasks.js b/src/scripts/tutti/10_tasks.js index 06beb11..bbe3bf2 100644 --- a/src/scripts/tutti/10_tasks.js +++ b/src/scripts/tutti/10_tasks.js @@ -269,11 +269,20 @@ $(function() { // rather than the thing we clicked on. var shot_id = e.delegateTarget.dataset.shotId; shot_open(shot_id); + + if ($(window).scrollTop() > 270) { + $("html, body").animate({scrollTop: 0 }, '500', 'swing'); + } }); + $("a.task-link[data-task-id]").click(function(e) { e.preventDefault(); var task_id = e.delegateTarget.dataset.taskId; task_open(task_id); + + if ($(window).scrollTop() > 270) { + $("html, body").animate({scrollTop: 0 }, '500', 'swing'); + } }); });