fix scrolling for item pages with a lot of tags
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 16s

This commit is contained in:
x
2025-07-22 01:35:17 +02:00
parent 5cdb86d710
commit 68cc9b2379

View File

@@ -307,4 +307,29 @@ window.requestAnimFrame = (function(){
// <scroller> // <scroller>
// </scroller> // </scroller>
})(); })();
// disable default scroll event when mouse is on content div
// this is useful for items that have a lot of tags for example: 12536
const targetSelector = '.content'; // <-- your target class
let isMouseOver = false;
function isPageScrollable() {
return document.documentElement.scrollHeight > document.documentElement.clientHeight;
}
function onWheel(e) {
if (isMouseOver && isPageScrollable()) {
e.preventDefault();
}
}
function init() {
const el = document.querySelector(targetSelector);
if (!el) return;
el.addEventListener('mouseenter', () => isMouseOver = true);
el.addEventListener('mouseleave', () => isMouseOver = false);
window.addEventListener('wheel', onWheel, { passive: false });
}
window.addEventListener('load', init);