From 1fc420574d269c8b5ed52ab61f6f560c0c8e8522 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.. --- .../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 0723e23069..9e806a81bc 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -4775,3 +4775,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 ab24a9304e..b475219164 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.30.2