diff --git a/opentech/static_src/src/javascript/main.js b/opentech/static_src/src/javascript/main.js index 3d3b58eaa51ffae560471a347099ed24c0c4d20c..cc47a52f20f258eebba5dec858b9801ca9cfec92 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)); });