Skip to content Skip to sidebar Skip to footer

Detect When User Scrolled Down And Reached Center Of Page

Currently I have the following code which detects when a user has started scrolling and if they've reached the center of the page. $(window).scroll(function() { if ($(windo

Solution 1:

Try this

$(document).on("scroll.y", function(e) {
  if ($("body").scrollTop() >= ( ($(e.target).height() / 2) -250) ) {
       console.log("approximate center"); $(e.target).off("scroll.y")
  };
  return false
})

Post a Comment for "Detect When User Scrolled Down And Reached Center Of Page"