If you go to http://www.deviantart.com/ and wait a few seconds so the javascript loads under the hood you can click a link and instead of going to the link you'll go to #/someId
. You can hit back/forward. I believe i saw similar behavior on other sites but without using #
in the url.
How do i do an event like make something visible or collapse something and undo (or redo) the event with the back/forward button?
Using Backbone.js's router functionality is the best solution I've found for this. This tutorial explains it well.
It's making use of pushState . Here is a sample page making use of this technique.
If you want to implement this, I really recommend using history.js . It covers some cross-browser issues that you'll otherwise run in to.
You can do this through jquery libraries...
Check out this for the visible and collapse http://jqueryui.com/demos/accordion/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.