Prinzhorn / skrollr

Stand-alone parallax scrolling library for mobile (Android + iOS) and desktop. No jQuery. Just plain JavaScript (and some love).
http://prinzhorn.github.io/skrollr/
MIT License
18.53k stars 3.5k forks source link

Use Skrollr in a div other than body #701

Open commonpike opened 9 years ago

commonpike commented 9 years ago

This has been asked here http://stackoverflow.com/questions/28865362/use-skrollr-in-a-div-other-than-body

And somewhere else answered by Prinzhorn, too (woohee!). nevertheless, I'm adding it as an issue here, because it now is an issue to me ;-)

How do I use Skrollr on a page if I already use a different div to scroll (#scrollable) other than the body?

The answer is, you don't.

The code everything seems to rely on is _instance.getScrollTop(), which, for desktops is

return window.pageYOffset || documentElement.scrollTop || body.scrollTop || 0;

I wonder if it makes sense to hack something in there ?

Prinzhorn commented 9 years ago

have you read through #232?

commonpike commented 9 years ago

No I didnt - and I still didnt until after I found all that out myself :-) You can mark this as a duplicate.

Thanks ! it 'seems to work' - lets see how far it goes.