I need assistance with the following scenario:
I have three pages set up and as the user scrolls through the page, when they reach the second page, it should locate a specific ID and trigger a function. Once the third page begins, another function should be triggered. I am not allowed to use any plugins as per the requirement.
<script>
$(window).on("scroll", function() {
var offset = $("#two").offset();
var posY = offset.top - $(window).scrollTop();
if (offset.top + $("#two").height() > $(window).scrollTop()) {
apply();
} else {
remove();
}
</script>
<body>
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
</body>