https://github.com/simov/simplr-smoothscroll
Smooth scrolling in all browsers
https://github.com/simov/simplr-smoothscroll
Last synced: 2 months ago
JSON representation
Smooth scrolling in all browsers
- Host: GitHub
- URL: https://github.com/simov/simplr-smoothscroll
- Owner: simov
- License: mit
- Created: 2013-01-14T22:55:14.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2021-02-27T00:58:09.000Z (almost 5 years ago)
- Last Synced: 2025-01-26T05:24:31.706Z (12 months ago)
- Language: HTML
- Homepage:
- Size: 199 KB
- Stars: 209
- Watchers: 19
- Forks: 91
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simplr-smoothscroll
## [DEMO](http://simov.github.io/simplr-smoothscroll/examples)
## Requirements
[jquery-mousewheel](https://github.com/jquery/jquery-mousewheel)
## Usage
```js
$(function () {
$.srSmoothscroll({
// defaults
step: 55,
speed: 400,
ease: 'swing',
target: $('body'),
container: $(window)
})
})
```
## Enable scrolling for specific widgets
See this [example](http://simov.github.io/simplr-smoothscroll/examples/example-02.html)
```html
lorem ipsum
lorem ipsum
```
```css
#container1 { width: 500px; height: 300px; overflow: auto; }
#container2 { width: 500px; height: 300px; overflow: auto; }
```
```js
$(function () {
$.srSmoothscroll({
target: $('#widget1'),
container: $('#container1')
})
$.srSmoothscroll({
target: $('#widget2'),
container: $('#container2')
})
})
```
## Browser and os detection
Browsers that support *smooth* scrolling natively may be excluded.
```js
$(function () {
var platform = navigator.platform.toLowerCase();
if (platform.indexOf('win') == 0 || platform.indexOf('linux') == 0) {
if ($.browser.webkit) {
$.srSmoothscroll();
}
}
});
```
This will enable *simplr-smoothscroll* only for webkit browsers on windows and linux.