Created
October 27, 2015 08:05
-
-
Save evdokimovm/3fe5a8fc4d086ea8e28f to your computer and use it in GitHub Desktop.
Save Scroll Position
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
var $window = $(window) | |
/* Restore scroll position */ | |
window.scroll(0, localStorage.getItem('scrollPosition')|0) | |
/* Save scroll position */ | |
$window.scroll(function () { | |
localStorage.setItem('scrollPosition', $window.scrollTop()) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment