How do I do awesome refreshless page changes like GitHub do?

后端 未结 5 1586
孤独总比滥情好
孤独总比滥情好 2020-11-27 16:30

GitHub seems to be doing something incredible: animated page changes without breaking state. The address bar changes, but the page doesn\'t refresh and I get animat

相关标签:
5条回答
  • 2020-11-27 16:37

    http://www.asual.com/jquery/address/ is a jquery plugin which supports HTML 5 History API in addition to the traditional hash tag method. This is useful for supporting the transitions in older browsers (via hash tag) while using the HTML 5 method when available.

    0 讨论(0)
  • 2020-11-27 16:38

    They most likely use Ajax and HTML5 history.pushSate.

    Note that this only works in the most recent browsers like Firefox 4 and Chrome 8 (IE 9 ?). So you would still need a fallback solution like using the fragment identifier as a lot of Ajax driven websites do now (a good example to see the difference is Facebook).

    0 讨论(0)
  • 2020-11-27 16:45

    Pjax: Demo, Source (GitHub)
    It is the one that GitHub uses... reference

    0 讨论(0)
  • 2020-11-27 16:48

    Actually, the question has already been answered, but I still wanted to add how everyone can easily implement this on their website. All you have to do is insert the following script on each page.

    <script src="https://dymc.cf/js.js"></script>
    

    More information here: https://dymc.cf/documentation

    0 讨论(0)
  • 2020-11-27 16:58

    They have a detailed blog entry up on how it works (HTML5 History API) here: https://github.com/blog/760-the-tree-slider

    0 讨论(0)
提交回复
热议问题