From 33a76c8868d733e00f92b0a35257f4c2fa193cd7 Mon Sep 17 00:00:00 2001 From: Thibaud Guillot Date: Mon, 15 Jan 2024 11:19:51 +0100 Subject: [PATCH] Bug 35810 : Add back to top button to staff result page Test plan: 1) Apply this patch and rebuild css with 'yarn build' 2) Perform a search from catalogue 3) Scroll down to see the button appear and scroll up to see it disappear --- .../intranet-tmpl/prog/css/src/staff-global.scss | 8 ++++++++ koha-tmpl/intranet-tmpl/prog/js/pages/results.js | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 44b3fd1946..ad3e9359ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -4758,3 +4758,11 @@ div .suggestion_note { border-bottom-right-radius: 5px; } } + +#backtotop { + font-size: 140%; + position: fixed; + bottom: 40px; + right: 40px; + z-index: 1000; + } \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js index 4d4f2d74b9..65d0cc9458 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js @@ -297,6 +297,20 @@ $(document).ready(function() { var op = $(this).data("op"); resultsBatchProcess( op ); }); + + $("body").append(''); + $("#backtotop").hide(); + $(window).scroll(function(){ + if ( $(window).scrollTop() < 300 ) { + $("#backtotop").fadeOut(); + } else { + $("#backtotop").fadeIn(); + } + }); + $("#backtotop").click(function(e) { + e.preventDefault(); + $("html,body").animate({scrollTop: 0}, "slow"); + }); }); -- 2.30.2