pushstate doens't work from outside the page
-
Hi, I’ve developed a one page site using parallax and I used the following code to update the url on scroll
<script> jQuery(document).scroll(function() { jQuery('section').each(function() { if(jQuery(this).offset().top < jQuery(window).scrollTop()) { history.pushState({}, '', jQuery(this).attr('id')); } }); }); </script>
It works fine and updates the url on scroll and on click from the main menu in the same page adding the id of the section where I want to go. The problem is that when I click on a link from another page of the same site does not find the page.
Thanks in advance
- The topic ‘pushstate doens't work from outside the page’ is closed to new replies.