Created
March 13, 2013 18:21
-
-
Save jamonholmgren/5154738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on "page:change", -> | |
window.prevPageYOffset = window.pageYOffset | |
window.prevPageXOffset = window.pageXOffset | |
$(document).on "page:load", -> | |
if $(".fix-scroll").length > 0 | |
$('.fix-scroll').hide().show() # force re-render -- having an issue with that on Chrome/OSX | |
window.scrollTo window.prevPageXOffset, window.prevPageYOffset |
Should fix-scroll be added to the body-tag?
This doesn't work on Turbolinks master anymore - the scroll position change happens before the page:change event fires.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank your publishing the solution, really neat :)