javascript - Trigger event when user scroll to specific element - with jQuery - Stack Overflow

PHOTO EMBED

Fri Oct 15 2021 10:35:33 GMT+0000 (UTC)

Saved by @fiki98

$(window).scroll(function() {
   var hT = $('#scroll-to').offset().top,
       hH = $('#scroll-to').outerHeight(),
       wH = $(window).height(),
       wS = $(this).scrollTop();
   if (wS > (hT+hH-wH)){
       console.log('H1 on the view!');
   }
});
content_copyCOPY

https://stackoverflow.com/questions/21561480/trigger-event-when-user-scroll-to-specific-element-with-jquery