body-scroll-toggle icon indicating copy to clipboard operation
body-scroll-toggle copied to clipboard

Switch to an implementation that doesn't set fixed on body

Open weotch opened this issue 9 years ago • 3 comments

This has ramifications on code (scrollMonitor for instance) that detects whether something is in viewport in IE and FF. Specifically, everything (at least momentarily) gets detected as out of viewport.

weotch avatar Dec 14 '16 00:12 weotch

I've tried implementing http://stackoverflow.com/a/4770179/59160 in https://github.com/BKWLD/body-scroll-toggle/tree/non-css but, like mentioned on that page, it stops all scroll events. So even scrolls inside of modals. In b462b7ba304c9bbfd2f6bc174cf17808d6e937a5 I tried to pass in a list of ignored els that scrolling within them, but the wheel events are never fired on the body, only what the mouse is over.

weotch avatar Dec 17 '16 00:12 weotch

Maybe the key is something like http://stackoverflow.com/a/12090055/59160 where we do a simple overflow for wheel and scrollbar events and then use JS to consume the touch events. ... I've tried hacking that into the project I'm working on now, targetting the bkgd of a modal, and no luck yet, but I don't think I've exhausted my options.

weotch avatar Dec 17 '16 01:12 weotch

Kind of an asside, but on Coachella I duck punched this into scrollMonitor:

scrollMonitor = require 'scrollmonitor'
scrollMonitor.pause = ->
	scrollMonitor.oldWatchers = scrollMonitor.watchers
	scrollMonitor.watchers = []
	console.log scrollMonitor.watchers
scrollMonitor.resume = ->
	scrollMonitor.watchers = scrollMonitor.oldWatchers
	scrollMonitor.oldWatchers = []

Would be cool to do from a listener of body scroll toggle...

weotch avatar Jan 03 '17 22:01 weotch