Bug 36694: Add JS observer to detect stuck sticky element
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
6f819b68d3
commit
65bdb6592a
|
|
@ -60,6 +60,16 @@ $.fn.selectTabByID = function (tabID) {
|
|||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
//check if sticky element is stuck, if so add floating class
|
||||
if ( $('#toolbar.sticky').length ) {
|
||||
const observer = new IntersectionObserver(
|
||||
([e]) => e.target.classList.toggle('floating', e.intersectionRatio < 1),
|
||||
{threshold: [1]}
|
||||
);
|
||||
|
||||
observer.observe(document.querySelector('.sticky'));
|
||||
}
|
||||
|
||||
//check for a hash before setting focus
|
||||
let hash = window.location.hash;
|
||||
if (!hash) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue