Looking for a Script to match and example
I've seen this site:
http://www.visitmanchester.com
开发者_如何学运维Essentially all of the content loads on the same page, dynamically. Pausing to load the content then scrolling to the correct portion of the page.
This is server + client functionality
Well basically this is not just a javascript solution but rather a server+client solution. If it was asp.net MVC on the server side you'd have the main page that would by default render a partial view "home" inside its content area.
All subsequent clicks on the top menu initate a regular $.get()
to server side that just returns the proper partial view and response function on the client:
- appends an inpage anchor at the end of the document
- appends returned partial view at the end of the document
- initiates a click to the newly appended inpage anchor
That explains the back button behaviour.
Haven't seen a script like it before, but it seems quite trivial to implement anyway. I've checked and there was no checking (even though there could be) whether the same content has already been loaded and replacing it with a fresh returned version. The bad side of not checking is that is the user clicks and clicks the document gets very long and uses more and more resources and slows down the page considerably.
精彩评论