Closed robbisy closed 6 years ago
Sorry, there is no function to create many watchers. You can do this if you have a polyfill for Array.from
var watchers = Array.from(myElements).map(scrollMonitor.create)
This will also work with document.querySelector
.
@stutrek Thanks for your answer I don't understand
This will also work with document.querySelector.
I thought that querySelector returns the first element that matches with the class. How could I create many watchers with document.querySelector ?
Hi I have multiple elements which have the same animation. Can I use getElementsByClassName instead of getElementById like this
var myElements = document.getElementsByClassName("itemsToWatch");
var elementsWatcher = scrollMonitor.create( myElements );