jquery.simple-scroll-follow
jQuery plugin to move the element according to the scrolling window.
Demo
https://sutara79.github.io/jquery.simple-scroll-follow/
Install
- GitHub: Clone or download.
- npm:
npm i jquery.simple-scroll-follow
- CDN (jsDelivr):
- jquery.simple-scroll-follow.min.js: v3.1.2
Usage
HTML
<div id="foo">Element to follow</div> <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <script src="jquery.simple-scroll-follow.min.js"></script>
CSS
body { background: url(null) fixed; /* for Google Chrome */ } #foo { position: absolute; }
JavaScript
$('#foo').simpleScrollFollow();
Option
name | type | default | description |
---|---|---|---|
limit_elem | Object, string | $('body') | An element that indicates lower limit to scroll |
min_width | number | 0 | Minimum window width to enable this plugin |
enabled | boolean | true | Enable scroll or not |
upper_side | string | null | An fixed element that indicates upper limit to scroll |
lower_side | string | null | An fixed element that indicates lower limit to scroll |
Public Method
(since v3.0.0)
For the details, see documentation.
.setEnabled()
Parameter
No. | type | default | description |
---|---|---|---|
1 | boolean | true | true : this plugin resumes.false : this plugin stops. |