1.1.1 • Published 8 years ago
jquery-scroll v1.1.1
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: 1. blod meaning required param, else optional 2. Indifferent params order 3. 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