https://github.com/b13/b_scrollto
https://github.com/b13/b_scrollto
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/b13/b_scrollto
- Owner: b13
- Created: 2015-10-07T07:29:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-07T09:25:28.000Z (over 10 years ago)
- Last Synced: 2025-03-09T23:38:55.931Z (over 1 year ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# b_scrollTo
Minimal js scrolling module.
## Installation via bower.
bower install b_scrollTo -S
## Usage
### Use it as AMD module.
//Scroll to window y-position of 300px.
require(['b_scrollTo']){
$.scrollToPixel(300);
};
### Scroll the window to a defined pixel height.
//With default animation duration of 500ms.
$.scrollToPixel(100);
//With specific animation duration of 1s.
$.scrollToPixel(100, 1000);
//If it should not be animated
$.scrollToPixel(100, 0);
//OR
$.scrollToPixel(100, false);
### Scroll to the top edge of an element.
$.scrollTo(element);
//OR
$(element).scrollTo();
//With a specific animation duration of 300ms.
$.scrollTo(element, 300);
//OR
$(element).scrollTo(300);
//Without animation
$.scrollTo(element, 0);
//OR
$.scrollTo(element, false);
//OR
$(element).scrollTo(0);
//OR
$(element).scrollTo(false);
//With a specific offset and the default duration. E.g. if you have an header with a height of 200px.
$.scrollTo(element, null, 200);
//OR
$(element).scrollTo(null, 200);
### Calling a function after the scrolling has finished.
$.scrollToPixel(400).done(function(){
//Do something . . .
});