I've used waypoints.js a few times before to great success. Using code like the example below:
$(document).ready(function() {
$('.section').waypoint(function() {
$(this).toggleClass('in-view');
},
{offset: '65%'});
});
That was created using version jQuery Waypoints - v2.0.3
. I'm trying to use the same code on a website I've inherited which uses Waypoints 4.0.1
but the above code doesn't work and I think that's because the script is the non-jQuery version.
So my question is, how would I format/write the above code in a noframework build?
I struggle enough with jQuery so code the the example below is totally foreign to me!
var waypoint = new Waypoint({
element: document.getElementById('waypoint'),
handler: function(direction) {
console.log('Scrolled to waypoint!')
}
})
How would I write my jQuery script in what I guess is plain javascript? Can someone shed some light on this please?
Thanks in advance!