From 97bb82731e00985f53025cdd13b5bcaffe6b6339 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 26 Apr 2024 17:37:52 +0000 Subject: [PATCH] Bug 36694: Remove HC sticky from OPAC pages Rebased-by: Victor Grousset/tuxayo --- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 2 +- koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss | 6 ++++++ koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt | 8 +------- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 9 +-------- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 9 +-------- koha-tmpl/opac-tmpl/bootstrap/js/global.js | 9 +++++++++ 6 files changed, 19 insertions(+), 24 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index 2fa567e99e..2f60702e7a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -61,7 +61,7 @@ $.fn.selectTabByID = function (tabID) { $(document).ready(function () { //check if sticky element is stuck, if so add floating class - if ( $('#toolbar.sticky').length ) { + if ( $('.sticky').length ) { const observer = new IntersectionObserver( ([e]) => e.target.classList.toggle('floating', e.intersectionRatio < 1), {threshold: [1]} diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss index f0e99ebf61..0940aa3175 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss +++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss @@ -2980,6 +2980,12 @@ $star-selected: #EDB867; margin-top: 30px; } +.sticky { + position: sticky; + top: -1px; + z-index: 999; +} + .chocolat-wrapper { z-index: 1050; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt index 36915017ab..c281c99686 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -19,7 +19,7 @@

Your cart

-
+
[% IF ( verbose ) %] Brief display @@ -364,7 +364,6 @@ [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] - [% Asset.js("lib/hc-sticky/hc-sticky.js") | $raw %] [% INCLUDE 'datatables.inc' %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt index 0686b5d506..bdadfc3bd3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -219,7 +219,7 @@ [% IF ( itemsloop ) %] [% SET contents = shelf.get_contents %] [% IF ( contents.count ) %]

This list contains [% contents.count | html %] titles

[% END %] -
+
New list | @@ -832,7 +832,6 @@ [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] -[% Asset.js("lib/hc-sticky/hc-sticky.js") | $raw %] [% IF OpenLibraryCovers || OpenLibrarySearch %] [% Asset.js("js/openlibrary.js") | $raw %] [% END %] @@ -1048,12 +1047,6 @@ $(function() { AdjustRemark(); - Sticky = $("#floating"); - Sticky.hcSticky({ - stickTo: "#usershelves", - stickyClass: "floating" - }); - [% IF itemsloop %] sortMenu( $("#sorting-form") ); diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/global.js b/koha-tmpl/opac-tmpl/bootstrap/js/global.js index 9a48e3a8f5..a6bf91884d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js @@ -250,6 +250,15 @@ var facetHandler = function (e) { }; $(document).ready(function () { + //check if sticky element is stuck, if so add floating class + if ( $('.sticky').length ) { + const observer = new IntersectionObserver( + ([e]) => e.target.classList.toggle('floating', e.intersectionRatio < 1), + {threshold: [1]} + ); + + observer.observe(document.querySelector('.sticky')); + } $("html").removeClass("no-js").addClass("js"); $(".close").click(function () { window.close(); -- 2.45.2