From 69f17da545db82b96025bd8c8d8559926e799fc0 Mon Sep 17 00:00:00 2001 From: Chris Lawton <chris.lawton@torchbox.com> Date: Tue, 6 Mar 2018 10:16:31 +0000 Subject: [PATCH] only show the scroll top top of activity feed button when the user has scroll passed the top of the window --- opentech/static_src/src/javascript/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/opentech/static_src/src/javascript/main.js b/opentech/static_src/src/javascript/main.js index 3d3b58eaa..cc47a52f2 100755 --- a/opentech/static_src/src/javascript/main.js +++ b/opentech/static_src/src/javascript/main.js @@ -50,6 +50,11 @@ import Tabs from './components/tabs'; $('.js-activity-feed').removeClass('is-open'); }); + // Show scroll to top of activity feed button on scroll + $('.js-activity-feed').on('scroll', function() { + $(this).scrollTop() === 0 ? $('.js-to-top').removeClass('is-visible') : $('.js-to-top').addClass('is-visible'); + }); + // Scroll to the top of the activity feed $('.js-to-top').click(() => $('.js-activity-feed').animate({ scrollTop: 0 }, 250)); }); -- GitLab