question
robbisy opened this issue · comments
robbisy commented
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 );
Stu Kabakoff commented
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
.