Skip to content

Commit

Permalink
Tweak jquery.pjax to not interfere with other popstate handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav authored and defunkt committed Mar 30, 2011
1 parent 98b072b commit a296dd8
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions jquery.pjax.js
Expand Up @@ -152,14 +152,17 @@ jQuery(window).bind('popstate', function(event){

var state = event.state

if ( state && $(state.pjax).length )
jQuery.pjax({
url: state.url || location.href,
container: state.pjax,
push: false
})
else
window.location = location.href
if ( state && state.pjax ) {
var container = $(state.pjax)
if ( container.length )
jQuery.pjax({
url: state.url || location.href,
container: container,
push: false
})
else
window.location = location.href
}
})


Expand Down

0 comments on commit a296dd8

Please sign in to comment.