Permalink
Browse files

pjaxing a URL with a #hash now scrolls you to the anchor when it loads.

  • Loading branch information...
spantaleev authored and defunkt committed Jun 5, 2011
1 parent 257a769 commit fdfd1ab30cf20edde00f6e168e58e7258a0c8cec
Showing with 8 additions and 0 deletions.
  1. +8 −0 jquery.pjax.js
View
@@ -148,6 +148,14 @@ $.pjax = function( options ) {
if ( (options.replace || options.push) && window._gaq )
_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.
success.apply(this, arguments)
}

0 comments on commit fdfd1ab

Please sign in to comment.