Remember The Last Scroll Position - jQuery scrollReminder
File Size: | 6.88 KB |
---|---|
Views Total: | 3785 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
scrollReminder is an ultra-light jQuery plugin that saves the current scroll position in the browser cookies and smoothly scrolls the page to most recent scroll position after page reloads.
See also:
How to use it:
1. Include the latest version of jQuery JavaScript library on the webpage.
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"> </script>
2. Include the latest version of js-cookie library to handle browser cookies.
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.0/js.cookie.min.js" integrity="sha384-ujpAYcyxFaJsZN5668lLgOpEH8vtWrbOq8fvj+WZ2kD71LJwGa/9QP/suPPF1hTI" crossorigin="anonymous"> </script>
3. Download and include the jQuery scrollReminder plugin after jQuery library.
<script src="jquery.scrollreminder.js"></script>
4. Call the function and done. By default, the plugin will automatically save the current scroll position of the whole page.
$(function(){ $(document).scrollreminder(); });
5. To change the default viewport you'd like to track the most rencent scroll position, follow this step.
$(function(){ $(document).scrollreminder({ viewName : 'your-view-name' }); });
This awesome jQuery plugin is developed by julien-its. For more Advanced Usages, please check the demo page or visit the official website.