How do one-page html pushstate?



  • How to use html5 history to replace url when the page is broken as on this website: http://www.collectif-yay.com/

    I've had a lot of forums, but I may have been looking bad.

    How do the button pressure change the content? http://xozblog.ru/demo/history-api-demo/pushState/ But that's how to do it on a one-page?



  • I found it on the Internet, hit a page on which four divas. It works. Thanks for the answers. If anyone's interested:

    function isScrolledIntoView(elem)
    {
    var $elem = $(elem);
    var $window = $(window);
    

    var docViewTop = $window.scrollTop();
    var docViewBottom = docViewTop + $window.height();

    var elemTop = $elem.offset().top;
    var elemBottom = elemTop + $elem.height();

    return ((elemBottom = docViewTop));

    $(window).scroll(function() {
    If (isScrolledIntoView#slide1) { window.history.pushState("state, "title," "slide1); return; }
    If (isScrolledIntoView#slide2) { window.history.pushState("state, "title," "slide2); return; }
    If (isScrolledIntoView#slide3) { window.history.pushState("state, "title," "slide3); return; }
    If (isScrolledIntoView#slide4) { window.history.pushState("state, "title," "slide4); return; }
    _




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2