diff --git a/melpomene.js b/melpomene.js index 04ac503..1ca0744 100644 --- a/melpomene.js +++ b/melpomene.js @@ -459,7 +459,19 @@ function handleKeyPress(key){ } -function handleMouseWhell(deltaY){ +function handleMouseWhell(event){ + + // Only handle scroll event if the target is the nav controls + // to avoid preventing page scrolling. + + // Do disable page scrolling when we do prev/next, though + + if (! READER_FRAME.contains(event.target)){ + return + } + + event.preventDefault() + event.stopPropagation() if (MOUSEWHELL_WAIT){ return @@ -470,7 +482,7 @@ function handleMouseWhell(deltaY){ }, MOUSEWHELL_MIN_DELAY) } - if (deltaY > 0) { + if (event.deltaY > 0) { moveReader(true, false) } @@ -497,5 +509,5 @@ addEventListener("keydown", (event) => { }); addEventListener("wheel", (event) => { - handleMouseWhell(event.deltaY) -}); + handleMouseWhell(event) +}, { passive:false });