Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple scrolls? #42

Open
neuropass opened this issue May 14, 2021 · 1 comment
Open

multiple scrolls? #42

neuropass opened this issue May 14, 2021 · 1 comment
Labels

Comments

@neuropass
Copy link

neuropass commented May 14, 2021

Hi Alberto,

How would I initiate multiple scrolls in a page in plain javascript?
Say I have the main element and then some other smaller elements I want optiscroll to work with.

EDIT:
this does not seem to be working:
var element = document.querySelectorAll("#scroll1, #scroll2");

Thanks!

@albertogasparin
Copy link
Owner

With plain javascript you have to create multiple Optiscoll instances yourself, as providing multiple elements is not supported.
Something like this should do the trick:

var elements = document.querySelectorAll("#scroll1, #scroll2");
elements.forEach((el) => new Optiscroll(el))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants