jQuery +最新的哈希更改侦听器? [英] Jquery + up to date hash change listener?

查看:83
本文介绍了jQuery +最新的哈希更改侦听器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 http://benalman.com/projects/jquery-hashchange- plugin/侦听我的项目中的哈希变化,但是他的插件已过时,无法与Firefox 9和IE9等较新版本的浏览器一起使用.

I'm using http://benalman.com/projects/jquery-hashchange-plugin/ to listen for hash changes in my project, but his plugin is outdated and does not work with newer versions of browsers such as Firefox 9 and IE9.

在Google和此处进行了搜索,但找不到其他任何插件.

Searched on Google and here but could not find any other plugin.

还是仅使用此代码定位大多数浏览器就足够了吗?

Or is it enough to just use this code to target most of the browsers?

$(window).bind('hashchange', function() {
    //code
});

似乎在这些浏览器中有关console.log()的问题,并且与hashchange无关.删除所有console.log输出

Seems like there was a problem regarding console.log() on these browsers and had nothing to do with the hashchange. It works like expected after removing all console.log output

推荐答案

您正在使用的插件仍然是最好的插件.要获得IE9支持,请查看.对于不支持哈希更改事件的浏览器,请考虑一些替代方法(可能会有所帮助).

Plugin you are using is still the best one available. For IE9 support check out this. Also consider some alternative for browsers that do not support hash change event (this may help).

这篇关于jQuery +最新的哈希更改侦听器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆