jQuery bind popstate event not passed

后端 未结 1 1490
一个人的身影
一个人的身影 2021-01-01 11:46

I\'m coding a little demo for the History API. And I\'m struggling with this:

$(window).bind(\'popstate\',  
    function(event) {
        console.log(\'po         


        
相关标签:
1条回答
  • 2021-01-01 12:35

    In the first instance, you're getting a normalized jQuery event object. In the second instance, you're getting the browser's event object. I assume that jQuery hasn't completed normalizing all the new HTML5 events and related attributes. Until then, you'll need to access the original event object. You can do that through the jQuery event object via the originalEvent property. You can find some additional details and examples here: stackoverflow.com/questions/7860960/popstate-returns-event-state-is-undefined

    event.originalEvent.state
    
    0 讨论(0)
提交回复
热议问题