Please help me for below scenario
i have 3 pages in place and user scrolls the page when scroll reach the second page, it has to find the specific ID and then trigger a function. once the third page starts another function triggers. As per the requirement i should not use any plugins
<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>