Is this a proper way to use History.js?

前端 未结 1 1933
没有蜡笔的小新
没有蜡笔的小新 2020-12-23 11:01

I was able to put together a simplified complete History.js example using three links to load fragments of content from a full page without updating the page and while updat

1条回答
  •  暖寄归人
    2020-12-23 11:20

    After working on this some more, I have come up with a simple, but complete example for how to use the latest History.js. Here is working jsfiddle example that does Ajax loads of HTML fragments hosted on Github

    
    
      
        
        Simple History.js Ajax example by dansalmo
    
        
        
    
        
      
      
        Home
        About
        Contact
        Other
    
        

    The whole page will not re-load when the content below is updated, yet the URL is clean and the back button works!


    Home Page content

    The content div will be updated with a selected div fragment from an HTML file hosted on github, however the broswer will see each content update request as a part of the page history so that the back button can be used.


    Adding more menu items is as simple as adding the new links and their corresponding html fragments.

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