jquery-scroll
v1.1.1
Published
scroll to a dom or y position
Downloads
2
Readme
scroll-to DOM or y position
Install
npm i jquery-scroll --save
Usage
scrollTo({param: value})
- selector/posY jQuery object or a Y position value
- callback [null] function body or name
- offset [0] number margin bootom to target
- duration [800] animate duration
- easing [swing/linear] animation timing function, more need plugin official doc
- element [html,body] default slide the document
NOTE:
- blod meaning required param, else optional
- Indifferent params order
- need webpack && bable-loader support
Example
- git clone this project
npm i
to install dependencenpm run example
then openhttp://localhost:8080/example/
import $ from 'jquery';
import scrollTo from 'jquery-scroll';
$('#scroll').on('click', function () {
scrollTo({
selector: '#about',
callback: () => { alert('scroll end') }
});
});
Changelog
- 1.1.0 change
params[element]
to a jquery object, not jquery selector. eg:$('#container')
, not#container