From d22fed899154bcf6e6d10c74fa0ff7112a9d8a74 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 on staff pages Test plan: 1) Apply this patch and rebuild css with 'yarn build' 2) For example, perform a search from catalogue 3) Scroll down to see the button appear and scroll up to see it disappear Note that it's works also on patron search etc.. Signed-off-by: Owen Leonard Signed-off-by: Pedro Amorim Signed-off-by: Emily Lamancusa Signed-off-by: Katrin Fischer (cherry picked from commit 926e87de86496003915247bf6d50e4290fd3a1e4) Signed-off-by: Fridolin Somers --- .../intranet-tmpl/prog/css/src/staff-global.scss | 8 ++++++++ koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) 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 62f14f115b..2e236cb97f 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -4767,3 +4767,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/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index a4dde721b1..874c9fd290 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -243,7 +243,20 @@ $(document).ready(function() { $("#bookbag_form a[href*='detail.pl?']").click(function(){ resetSearchContext(); }); - + // add back to top button on each staff page + $("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"); + }); }); function removeLastBorrower(){ -- 2.39.5