On - [removed].hash - Change?

后端 未结 13 1535
谎友^
谎友^ 2020-11-21 13:38

I am using Ajax and hash for navigation.

Is there a way to check if the window.location.hash changed like this?

http://example.com/blah

13条回答
  •  Happy的楠姐
    2020-11-21 13:57

    Another great implementation is jQuery History which will use the native onhashchange event if it is supported by the browser, if not it will use an iframe or interval appropriately for the browser to ensure all the expected functionality is successfully emulated. It also provides a nice interface to bind to certain states.

    Another project worth noting as well is jQuery Ajaxy which is pretty much an extension for jQuery History to add ajax to the mix. As when you start using ajax with hashes it get's quite complicated!

提交回复
热议问题