Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added reset scroll position per @moomerman issue #66

  • Loading branch information...
commit e25c7b7c81596a21f5053c77efb6a77e57ab39d2 1 parent a5e8156
David Estes davydotcom authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/assets/javascripts/turbolinks.js.coffee
4 lib/assets/javascripts/turbolinks.js.coffee
View
@@ -23,6 +23,7 @@ fetchReplacement = (url) ->
unless assetsChanged extractAssetsFrom doc
changePage extractTitleAndBody(doc)...
reflectRedirectedUrl xhr
+ resetScrollPosition()
triggerEvent 'page:load'
xhr.onabort = -> console.log 'Aborted turbolink fetch!'
xhr.send()
@@ -89,6 +90,9 @@ rememberInitialPage = ->
recallScrollPosition = (page) ->
window.scrollTo page.positionX, page.positionY
+resetScrollPosition = ->
+ window.scrollTo 0, 0
+
extractAssetsFrom = (doc) ->
headAssets = []
for script in document.head.getElementsByTagName 'script'
Please sign in to comment.
Something went wrong with that request. Please try again.