diff --git a/public/s/js/f0ck.js b/public/s/js/f0ck.js index 07894b6..13769d0 100644 --- a/public/s/js/f0ck.js +++ b/public/s/js/f0ck.js @@ -307,4 +307,29 @@ window.requestAnimFrame = (function(){ // // -})(); \ No newline at end of file +})(); + +// 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); \ No newline at end of file