stutrek/scrollmonitor-parallax

Pass an existing scrollMonitor container?

Closed this issue · 4 comments

It could be useful to pass an existing scrollMonitor container, rather than always using the default
constructor. I'm looking at removing existing scroll event listeners when rebuilding the DOM from scratch (as with something like Turbolinks), but it seems like it would also allow the use of this library if the window is not the scroll container.

I can make a PR, but I wanted to check if there was a particular approach you would prefer.

That is absolutely a missing feature, as is documentation :).

Unless you already have it implemented post an example of how you think it should be used and we'll discuss. Maybe someone else will also see it and have an opinion.

Thanks, @stutrek. I don't have an implementation yet, but I looked over the code. It seems like the simplest thing would be to just add another argument to the create function, that would then be passed along to the Root and OptionsParallax constructors. However, once you start adding arguments, it raises the question of whether you want an argument for a general options object, and that's often the kind of thing that people have opinions about, so I wanted to check in with you first.

I agree. I think three arguments is fine.