I want to use jQuery Waypoints to add a class to an element when it is visible in the viewport. It is simple to target one element, but I can't figure out how to use it with multiple elements. It should be something like this:
$(function() {
const MyVariable = [
'main.home section.blocks .text',
'main.page ul li',
'main.contact .header div',
'etc etc',
];
$(MyVariable).waypoint(function() {
$(this.element).addClass('animate');
}, {
offset: '100%'
});
});
Thanks for helping out!