jQuery - change URL with .pushState without redirection

0 votes
216 views
added Jul 31, 2019 in jQuery by LC Marshal Captain (25,790 points)
//for infinite scroll usage, need to use pushstate 
$(window).on('resize scroll', function() {
  if ($('#nexpost').isInViewport()) {
    window.history.pushState("", "", '/newpage');
  } else {
    // do something else
  }
});

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...