$(window).scroll(function() {
//$(window).data('scrollEvent', function() {
var hT = $('.section1').offset().top,
hH = $('.section1').outerHeight(),
wH = $(window).height(),
wS = $(this).scrollTop();
if (wS > (hT+hH-wH)){
//I do something
$(window).off("scroll");
}
});
Used .off() to fire the event only once. However, unable to trigger events for subsequent sections on the page any longer even after using $(window).on("scroll");
How can I best trigger events for all the sections on a page just once on scrolling