相关疑难解决方法(0)

jQuery绑定popstate事件未通过

我正在为History API编写一个小程序.我正在努力解决这个问题:

$(window).bind('popstate',  
    function(event) {
        console.log('pop: ' + event.state);
    });
Run Code Online (Sandbox Code Playgroud)

当我点击"上一步"按钮时,它会记录'pop:undefined'

但是,如果我这样做,事情就像预期的那样:

window.onpopstate = function(event) {
    console.log('pop: ' + event.state);
};
Run Code Online (Sandbox Code Playgroud)

它这次记录'pop:[object Object]'...

所以就像jQuery没有将事件对象传递给回调.
jQuery有问题吗?或者我弄乱了什么?

jquery html5 html5-history

25
推荐指数
1
解决办法
3万
查看次数

标签 统计

html5 ×1

html5-history ×1

jquery ×1