Maintain Vertical Scroll Position With jQuery - rememberScroll.js

File Size: 10.1 KB
Views Total: 3477
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Maintain Vertical Scroll Position With jQuery - rememberScroll.js

rememberScroll.js is a lightweight yet useful jQuery plugin that uses cookies to maintain the vertical scroll positions on page refresh and/or re-visit.

How to use it:

1. Include the necessary jQuery JavaScript library and jQuery Cookies plugin on the webpage.

<script src="/path/to/jquery.min.js"></script>
<script src="/path/to/jquery.cookie.js"></script>

2. Download and include the jQuery rememberScroll.js script after jQuery.

<script src="jquery.rememberscroll.js"></script>

3. The JavaScript to enable tracking of web page scroll position:

$.positionTrack()

4. Set the frequency in seconds the scroll position will be queried:

$.positionTrack(2)

5. Configure the Cookie expiredays:

$.scrollTrack(1, 365*2)

Change log:

2018-01-26


This awesome jQuery plugin is developed by tnty. For more Advanced Usages, please check the demo page or visit the official website.