Skip to content

Commit

Permalink
pjaxing a URL with a #hash now scrolls you to the anchor when it loads.
Browse files Browse the repository at this point in the history
  • Loading branch information
spantaleev authored and defunkt committed Jun 5, 2011
1 parent 257a769 commit fdfd1ab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions jquery.pjax.js
Expand Up @@ -148,6 +148,14 @@ $.pjax = function( options ) {
if ( (options.replace || options.push) && window._gaq ) if ( (options.replace || options.push) && window._gaq )
_gaq.push(['_trackPageview']) _gaq.push(['_trackPageview'])


// If the URL has a hash in it, make sure the browser
// knows to navigate to the hash.
var hash = window.location.hash.toString()
if ( hash !== '' ) {
window.location.hash = ''
window.location.hash = hash
}

// Invoke their success handler if they gave us one. // Invoke their success handler if they gave us one.
success.apply(this, arguments) success.apply(this, arguments)
} }
Expand Down

0 comments on commit fdfd1ab

Please sign in to comment.