Compare commits
184 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f7595a34f | ||
|
|
97a44c29a8 | ||
|
|
467cdb17ed | ||
|
|
6ac02fae2b | ||
|
|
d4ec7fca6d | ||
|
|
0022bd5595 | ||
|
|
1b1195288b | ||
|
|
e6590da884 | ||
|
|
e98bfec4f2 | ||
|
|
f7d90464e0 | ||
|
|
337c0be9e2 | ||
|
|
36c988faba | ||
|
|
a573d2cd9d | ||
|
|
f231110f21 | ||
|
|
503b05f5ae | ||
|
|
abab1e47a4 | ||
|
|
c1b40168f6 | ||
|
|
937463cf75 | ||
|
|
424e577dbc | ||
|
|
575280e9c2 | ||
|
|
d3181f0b0d | ||
|
|
0fc81dfa83 | ||
|
|
1d315786a0 | ||
|
|
32a0caf2d8 | ||
|
|
22bffa9ba8 | ||
|
|
babd3949c7 | ||
|
|
cbdccf9736 | ||
|
|
a63c136c09 | ||
|
|
d272206181 | ||
|
|
a022621df8 | ||
|
|
2b87bbe081 | ||
|
|
cee1e3f015 | ||
|
|
c5f442a70e | ||
|
|
6b35561bb3 | ||
|
|
57cc39e6e8 | ||
|
|
3adb98cd40 | ||
|
|
4e90f8c170 | ||
|
|
eb13d331d9 | ||
|
|
c6f2e6abd3 | ||
|
|
845452f654 | ||
|
|
49a2a694b9 | ||
|
|
1f8a37894b | ||
|
|
fd56fdfe02 | ||
|
|
6fa5f198e2 | ||
|
|
f8759f713c | ||
|
|
4b3b057838 | ||
|
|
b5675c4d5b | ||
|
|
6e2d95f309 | ||
|
|
630f0686a9 | ||
|
|
bd99960ed1 | ||
|
|
b8231ecd79 | ||
|
|
4a8e8066ab | ||
|
|
61e1e6893d | ||
|
|
8d30c29602 | ||
|
|
f77fa0b05b | ||
|
|
6559492079 | ||
|
|
70fcb3a6c4 | ||
|
|
4357617540 | ||
|
|
0f5384948e | ||
|
|
9a589639b0 | ||
|
|
b26933e6a5 | ||
|
|
32718ae9cc | ||
|
|
fdcedcbbf5 | ||
|
|
9225275e6c | ||
|
|
84360fb730 | ||
|
|
1a335902cc | ||
|
|
2ccb8f18d5 | ||
|
|
da05a85ed6 | ||
|
|
57e5710ab0 | ||
|
|
9420d1b6a9 | ||
|
|
ee7d3bf62c | ||
|
|
275a928532 | ||
|
|
fc24bbc631 | ||
|
|
b45a94971c | ||
|
|
0544fe7241 | ||
|
|
bc6ef6480a | ||
|
|
04391d4dec | ||
|
|
fa03b68938 | ||
|
|
fa51f455fe | ||
|
|
aa0b57c51d | ||
|
|
a9000d4b6d | ||
|
|
4c0163a2f6 | ||
|
|
f1491e777d | ||
|
|
c1c41e6d14 | ||
|
|
e159cbbda5 | ||
|
|
b8d8218c03 | ||
|
|
d58e109d98 | ||
|
|
de3bc97437 | ||
|
|
63c6d67ad5 | ||
|
|
40b46a4071 | ||
|
|
71838b9f72 | ||
|
|
693bc9b784 | ||
|
|
23722670c2 | ||
|
|
e390a89f57 | ||
|
|
6595d602b1 | ||
|
|
05fadaa786 | ||
|
|
fa806adb55 | ||
|
|
ad0e1e4fab | ||
|
|
43c7b22678 | ||
|
|
51db8add43 | ||
|
|
8ea7291469 | ||
|
|
c4632c97ed | ||
|
|
7fec407295 | ||
|
|
67635e54d7 | ||
|
|
b0c8e91f18 | ||
|
|
18c9517205 | ||
|
|
16998f95f1 | ||
|
|
7a65e01ab5 | ||
|
|
067b10d83d | ||
|
|
58261f2ace | ||
|
|
ebef76a2c6 | ||
|
|
be5e338869 | ||
|
|
cf8cea8b13 | ||
|
|
74f97e330e | ||
|
|
b461fa895b | ||
|
|
af7194114a | ||
|
|
540834308e | ||
|
|
bdda167317 | ||
|
|
123b1d724b | ||
|
|
68032d168b | ||
|
|
ab2a018c93 | ||
|
|
68c297fe2c | ||
|
|
09c0fb89d2 | ||
|
|
5124a27113 | ||
|
|
fa5e6cb38c | ||
|
|
dd89f14243 | ||
|
|
7e5b225d61 | ||
|
|
e35920f10e | ||
|
|
4f6463114c | ||
|
|
f02f5e89b7 | ||
|
|
21d5d4ab63 | ||
|
|
e833f42d02 | ||
|
|
a52d55957d | ||
|
|
e93d67e754 | ||
|
|
37210ee453 | ||
|
|
6021ec016e | ||
|
|
9be4a1a85f | ||
|
|
f65c9cb0bb | ||
|
|
29a0c13c65 | ||
|
|
d8c961ee32 | ||
|
|
a4d8487ee3 | ||
|
|
ff55090cd3 | ||
|
|
7bc05bbda1 | ||
|
|
3b1c37440e | ||
|
|
aeab94c7d6 | ||
|
|
eb8f28cd26 | ||
|
|
d5ef529438 | ||
|
|
34a505d319 | ||
|
|
a8db04e41d | ||
|
|
d14dfd307e | ||
|
|
de6e4d59b0 | ||
|
|
351631cfa7 | ||
|
|
2f6432d263 | ||
|
|
3410cf89be | ||
|
|
b89660f959 | ||
|
|
d5dd3422cf | ||
|
|
c6c087275c | ||
|
|
4613c3daee | ||
|
|
667c61d2c3 | ||
|
|
4012ce9c8c | ||
|
|
9734a18d01 | ||
|
|
4f49b0fa7f | ||
|
|
9d6728e3ff | ||
|
|
69c37268a1 | ||
|
|
960468fc9e | ||
|
|
42d528a839 | ||
|
|
26e9ff1cac | ||
|
|
38b8b818e8 | ||
|
|
938f3134d7 | ||
|
|
aa213398f3 | ||
|
|
1cdbc9509f | ||
|
|
627b6a6b81 | ||
|
|
0099bb556c | ||
|
|
2e1e9f2f75 | ||
|
|
f3b6fd520c | ||
|
|
a6bb9d02a3 | ||
|
|
639f369d33 | ||
|
|
dacb601f9f | ||
|
|
0c9dc8dbb4 | ||
|
|
f32e32485b | ||
|
|
a4bee31597 | ||
|
|
bd9e96be12 | ||
|
|
1bd0c102db | ||
|
|
36ae8c4059 |
3
.csslintrc
Normal file
3
.csslintrc
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"adjoining-classes": false
|
||||
}
|
||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
bower_components
|
||||
61
.jshintrc
Normal file
61
.jshintrc
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"passfail" : false,
|
||||
"maxerr" : 100,
|
||||
|
||||
"browser" : true,
|
||||
|
||||
"node" : true,
|
||||
"rhino" : false,
|
||||
"couch" : false,
|
||||
"wsh" : false,
|
||||
|
||||
"jquery" : true,
|
||||
"prototypejs" : false,
|
||||
"mootools" : false,
|
||||
"dojo" : false,
|
||||
|
||||
"predef" : [
|
||||
"require",
|
||||
"define"
|
||||
],
|
||||
|
||||
"debug" : false,
|
||||
"devel" : true,
|
||||
|
||||
"strict" : true,
|
||||
"globalstrict" : false,
|
||||
|
||||
"asi" : false,
|
||||
"laxbreak" : false,
|
||||
"bitwise" : false,
|
||||
"boss" : false,
|
||||
"curly" : true,
|
||||
"eqeqeq" : true,
|
||||
"eqnull" : false,
|
||||
"evil" : false,
|
||||
"expr" : false,
|
||||
"forin" : false,
|
||||
"immed" : true,
|
||||
"latedef" : true,
|
||||
"loopfunc" : false,
|
||||
"noarg" : true,
|
||||
"regexp" : true,
|
||||
"regexdash" : false,
|
||||
"scripturl" : true,
|
||||
"shadow" : false,
|
||||
"supernew" : false,
|
||||
"undef" : true,
|
||||
|
||||
"newcap" : true,
|
||||
"noempty" : false,
|
||||
"nonew" : true,
|
||||
"nomen" : false,
|
||||
"onevar" : false,
|
||||
"plusplus" : false,
|
||||
"sub" : false,
|
||||
"trailing" : true,
|
||||
"white" : true,
|
||||
"indent" : 2,
|
||||
"laxcomma" : true,
|
||||
"camelcase" : true
|
||||
}
|
||||
5
.travis.yml
Normal file
5
.travis.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
before_script:
|
||||
- npm install -g grunt-cli
|
||||
96
Gruntfile.js
Normal file
96
Gruntfile.js
Normal file
@@ -0,0 +1,96 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (grunt) {
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
// Metadata.
|
||||
pkg: grunt.file.readJSON('perfect-scrollbar.jquery.json'),
|
||||
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n' +
|
||||
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
|
||||
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
||||
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
|
||||
clean: {
|
||||
files: ['min']
|
||||
},
|
||||
// Task configuration.
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '<%= banner %>'
|
||||
},
|
||||
min: {
|
||||
files: {
|
||||
'min/perfect-scrollbar.min.js': ['src/perfect-scrollbar.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
gruntfile: {
|
||||
options: {
|
||||
jshintrc: '.jshintrc'
|
||||
},
|
||||
src: 'Gruntfile.js'
|
||||
},
|
||||
src: {
|
||||
options: {
|
||||
jshintrc: '.jshintrc'
|
||||
},
|
||||
src: 'src/perfect-scrollbar.js'
|
||||
}
|
||||
},
|
||||
csslint: {
|
||||
strict: {
|
||||
options: {
|
||||
csslintrc: '.csslintrc',
|
||||
'import': 2
|
||||
},
|
||||
src: ['src/perfect-scrollbar.css']
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
options: {
|
||||
banner: '<%= banner %>'
|
||||
},
|
||||
minify: {
|
||||
expand: true,
|
||||
cwd: 'src/',
|
||||
src: ['perfect-scrollbar.css'],
|
||||
dest: 'min/',
|
||||
ext: '.min.css'
|
||||
}
|
||||
},
|
||||
bump: {
|
||||
options: {
|
||||
files: ['package.json', 'bower.json', 'perfect-scrollbar.jquery.json'],
|
||||
updateConfigs: ['pkg'],
|
||||
commit: false,
|
||||
createTag: false,
|
||||
push: false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// These plugins provide necessary tasks.
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-csslint');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
grunt.loadNpmTasks('grunt-bump');
|
||||
|
||||
grunt.registerTask('default', 'List commands', function () {
|
||||
grunt.log.writeln("");
|
||||
|
||||
grunt.log.writeln("Run 'grunt lint' to lint the source files");
|
||||
grunt.log.writeln("Run 'grunt build' to minify the source files");
|
||||
});
|
||||
|
||||
grunt.registerTask('lint', ['jshint', 'csslint']);
|
||||
grunt.registerTask('build', ['clean', 'uglify', 'cssmin']);
|
||||
grunt.registerTask('travis', ['lint']);
|
||||
grunt.registerTask('release', 'Release a new version', function (arg) {
|
||||
var bumpType = arg ? ':' + arg : '';
|
||||
grunt.task.run(['lint', 'bump' + bumpType, 'build']);
|
||||
});
|
||||
|
||||
};
|
||||
145
README.md
145
README.md
@@ -1,4 +1,4 @@
|
||||
perfect-scrollbar
|
||||
perfect-scrollbar [](https://travis-ci.org/noraesae/perfect-scrollbar)
|
||||
=================
|
||||
|
||||
Tiny but perfect jQuery scrollbar plugin
|
||||
@@ -6,14 +6,14 @@ Tiny but perfect jQuery scrollbar plugin
|
||||
Why perfect-scrollbar?
|
||||
------------------
|
||||
|
||||
I worked on the personal project recently, and I was trying to find the jQuery scrollbar plugin that's *perfect*. But there was no *perfect* scrollbar plugin. That's why I decided to make one.
|
||||
I worked on a personal project recently, and I was trying to find the jQuery scrollbar plugin that's *perfect*. But there was no *perfect* scrollbar plugin. That's why I decided to make one.
|
||||
|
||||
perfect-scrollbar is very tiny but *perfect*(for me, and maybe for the most of developers) jQuery scrollbar plugin.
|
||||
perfect-scrollbar is very tiny but *perfect* (for me, and maybe for the most of developers) jQuery scrollbar plugin.
|
||||
I hope you love this!
|
||||
|
||||
Demo: http://noraesae.github.com/perfect-scrollbar/
|
||||
|
||||
What means *perfect*?
|
||||
What does *perfect* mean?
|
||||
---------------------
|
||||
|
||||
*perfect* means...
|
||||
@@ -36,22 +36,101 @@ Yes! the only thing that's not *perfect* is my English.
|
||||
|
||||
It's cool, isn't it?
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
You can download the latest stable version with download links in [Github Page](http://noraesae.github.io/perfect-scrollbar/). You also can find all releases in [Releases](https://github.com/noraesae/perfect-scrollbar/releases) page.
|
||||
|
||||
If you want to use the development version of the plugin, use the source files which are not minified. They're in the `src` directory. The development version may be unstable, but some known bugs can be fixed.
|
||||
|
||||
```
|
||||
git clone https://github.com/noraesae/perfect-scrollbar.git
|
||||
cd perfect-scrollbar/src
|
||||
```
|
||||
|
||||
You can use [Bower](http://bower.io/) to install the plugin. The plugin is registered as `perfect-scrollbar`.
|
||||
|
||||
```
|
||||
bower install perfect-scrollbar
|
||||
```
|
||||
|
||||
You can also load it from [cdnjs](http://cdnjs.com/). It is registered as [`jquery.perfect-scrollbar`](http://www.cdnjs.com/libraries/jquery.perfect-scrollbar).
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
To make this plugin *perfect*, some requirements was not avoidable. But they're all very trivial and there's nothing to worry.
|
||||
To make this plugin *perfect*, some requirements were not avoidable. But they're all very trivial and there's nothing to worry about.
|
||||
|
||||
* there must be the *one* content element(like div) for the container.
|
||||
* the container must have a 'position' css style.
|
||||
* the container must have an 'overflow:hidden' css style.
|
||||
* the scrollbar's position must be 'absolute'.
|
||||
* the scrollbar-x must have a 'bottom' css style, and the scrollbar-y must have a 'right' css style.
|
||||
|
||||
The requirement below is for perfect-scrollbar <= 0.3.4
|
||||
|
||||
* there must be the *one* content element(like div) for the container.
|
||||
|
||||
Optional parameters
|
||||
-------------------
|
||||
|
||||
perfect-scrollbar supports optional parameters.
|
||||
|
||||
### wheelSpeed
|
||||
The scroll speed applied to mousewheel event.
|
||||
**Default: 1**
|
||||
|
||||
### wheelPropagation
|
||||
If this option is true, when the scroll reach the end of the side, mousewheel event will be propagated to parent element.
|
||||
*Currently not supported for touch events*
|
||||
**Default: false**
|
||||
|
||||
|
||||
### minScrollbarLength
|
||||
When set to an integer value, the thumb part of the scrollbar will not shrink below that number of pixels.
|
||||
**Default: null**
|
||||
|
||||
### maxScrollbarLength
|
||||
When set to an integer value, the thumb part of the scrollbar will not expand over that number of pixels.
|
||||
**Default: null**
|
||||
|
||||
### useBothWheelAxes
|
||||
When set to true, and only one (vertical or horizontal) scrollbar is visible then both vertical and horizontal scrolling will affect the scrollbar.
|
||||
**Default: false**
|
||||
|
||||
### useKeyboard
|
||||
When set to true, the scroll works with arrow keys on the keyboard. The element is scrolled only when the mouse cursor hovers the element.
|
||||
**Default: true**
|
||||
|
||||
### suppressScrollX
|
||||
When set to true, the scroll bar in X axis will not be available, regardless of the content width.
|
||||
**Default: false**
|
||||
|
||||
### suppressScrollY
|
||||
When set to true, the scroll bar in Y axis will not be available, regardless of the content height.
|
||||
**Default: false**
|
||||
|
||||
### scrollXMarginOffset
|
||||
The number of pixels the content width can surpass the container width without enabling the X axis scroll bar. Allows some "wiggle room" or "offset break", so that X axis scroll bar is not enabled just because of a few pixels.
|
||||
**Default: 0**
|
||||
|
||||
### scrollYMarginOffset
|
||||
The number of pixels the content height can surpass the container height without enabling the Y axis scroll bar. Allows some "wiggle room" or "offset break", so that Y axis scroll bar is not enabled just because of a few pixels.
|
||||
**Default: 0**
|
||||
|
||||
### includePadding
|
||||
When set to true, it uses `innerWidth` and `innerHeight` for the container size instead of `width` and `height`. When your container element has non-zero padding and the scrollbar layout looks weird, this option can be helpful.
|
||||
**Default: false**
|
||||
|
||||
How to Use
|
||||
----------
|
||||
|
||||
```html
|
||||
<style>
|
||||
#Demo { position: 'relative'; }
|
||||
#Demo {
|
||||
position: relative;
|
||||
height: 100%; /* Or whatever you want (eg. 400px) */
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
<div id='Demo'>
|
||||
<div>
|
||||
@@ -63,6 +142,16 @@ When the html document is like above, just use like this:
|
||||
```javascript
|
||||
$('#Demo').perfectScrollbar();
|
||||
```
|
||||
|
||||
With optional parameters:
|
||||
```javascript
|
||||
$("#Demo").perfectScrollbar({
|
||||
wheelSpeed: 20,
|
||||
wheelPropagation: true,
|
||||
minScrollbarLength: 20
|
||||
})
|
||||
```
|
||||
|
||||
If the size of your container or content changes:
|
||||
```javascript
|
||||
$('#Demo').perfectScrollbar('update');
|
||||
@@ -72,39 +161,51 @@ If you want to destory the scrollbar:
|
||||
$('#Demo').perfectScrollbar('destroy');
|
||||
```
|
||||
|
||||
Very helpful friends
|
||||
--------------------
|
||||
If you want to scroll to somewhere, just use scroll-top css and update.
|
||||
```javascript
|
||||
$("#Demo").scrollTop(0);
|
||||
$("#Demo").perfectScrollbar('update');
|
||||
```
|
||||
|
||||
perfect-scrollbar supports [jquery-mousewheel](https://github.com/brandonaaron/jquery-mousewheel). If you want to use mousewheel features, please include jquery-mousewheel before using perfect-scrollbar.
|
||||
|
||||
If you want to make this plugin's update function more responsive, [jquery-resize](https://github.com/cowboy/jquery-resize) can be helpful.
|
||||
Also you can get the informations about how to use the plugin from example codes in the `examples` directory of the source tree.
|
||||
|
||||
Contribution
|
||||
------------
|
||||
|
||||
#### Please read [Contributing](https://github.com/noraesae/perfect-scrollbar/wiki/Contributing) in the wiki before making any contibution.
|
||||
|
||||
|
||||
I *really* welcome contributions! Please feel free to fork and issue pull requests when...
|
||||
|
||||
* You have a very nice idea to improve this plugin!
|
||||
* You found a bug!
|
||||
* You're good at English and can help my bad English!
|
||||
|
||||
Also you can just open issues, and I can look into them.
|
||||
For IE problems, please refer to [IE Support](https://github.com/noraesae/perfect-scrollbar#ie-support)
|
||||
|
||||
IE Support
|
||||
----------
|
||||
|
||||
This plugin supports old IE browsers in the **minimum** range. The plugin is tested in IEs >= IE6 and works(not well, but works).
|
||||
|
||||
**But the project will not accept the patches to fix IE problems in IE 6/7/8.**
|
||||
|
||||
From jQuery 2.0, jQuery also will not support IE 6/7/8. I also think that supporting old browsers really breaks the web development conventions.
|
||||
|
||||
When old IEs should be supported, please fork the project and make patches personally.
|
||||
|
||||
Helpdesk
|
||||
--------
|
||||
|
||||
If you have any idea to improve this project or any problem using this, please feel free to upload an [issue](https://github.com/noraesae/perfect-scrollbar/issues).
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
The MIT License (MIT) Copyright (c) 2012 HyeonJe Jun.
|
||||
The MIT License (MIT) Copyright (c) 2012, 2014 Hyunje Alex Jun and other contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**It means, you can freely fork and modify this project for commercial or non-comercial use!**
|
||||
|
||||
Helpdesk
|
||||
--------
|
||||
|
||||
If you have any idea to improve this project or any problems using this, please feel free to contact me.
|
||||
Email: noraesae@yuiazu.net
|
||||
|
||||
24
bower.json
Normal file
24
bower.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "perfect-scrollbar",
|
||||
"version": "0.5.3",
|
||||
"homepage": "http://noraesae.github.io/perfect-scrollbar/",
|
||||
"authors": [
|
||||
"Hyunje Alex Jun <me@noraesae.net>"
|
||||
],
|
||||
"description": "Tiny but perfect jQuery scrollbar plugin",
|
||||
"main": [
|
||||
"src/perfect-scrollbar.css",
|
||||
"src/perfect-scrollbar.js"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": ">=1.10"
|
||||
}
|
||||
}
|
||||
3
build
3
build
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
uglifyjs src/perfect-scrollbar.js > min/perfect-scrollbar.min.js
|
||||
cleancss src/perfect-scrollbar.css -o min/perfect-scrollbar.min.css
|
||||
BIN
examples/azusa.jpg
Normal file
BIN
examples/azusa.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
20
examples/iframe-content.html
Normal file
20
examples/iframe-content.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<style>
|
||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: hidden; }
|
||||
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
|
||||
.spacer { text-align:center }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="Default" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
27
examples/iframe.html
Normal file
27
examples/iframe.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
#iframe { width: 100%; min-height: 450px; border: 0; }
|
||||
html { direction: rtl; }
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
$('#iframe').load(function() {
|
||||
var contentIframe = $(this).contents();
|
||||
var documentIframe = contentIframe.get(0);
|
||||
$('#Default', documentIframe).perfectScrollbar();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="iframe-content.html" id="iframe"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
38
examples/options-default.html
Normal file
38
examples/options-default.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: hidden; }
|
||||
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
|
||||
.spacer { text-align:center }
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
$('#Default').perfectScrollbar();
|
||||
});
|
||||
var updateSize = function () {
|
||||
var width = parseInt($('#width').val(), 10);
|
||||
var height = parseInt($('#height').val(), 10);
|
||||
$('#Default').width(width).height(height).perfectScrollbar('update');
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="Default" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
<p style='text-align: center'>
|
||||
Width <input type='text' id='width' value='600'>
|
||||
Height <input type='text' id='height' value='400'>
|
||||
<button onclick='updateSize()'>Change!</button>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
34
examples/options-minScrollbarLength.html
Normal file
34
examples/options-minScrollbarLength.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 640px; height: 360px; overflow: hidden; }
|
||||
.contentHolder .content { background-image: url('./azusa.jpg'); width: 12800px; height: 7200px; }
|
||||
.spacer { text-align:center }
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
$('#Default').perfectScrollbar();
|
||||
$('#LongThumb').perfectScrollbar({minScrollbarLength:100});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">No minimum</h1>
|
||||
<div id="Default" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
<h1 style="text-align:center">100px minimum</h1>
|
||||
<div id="LongThumb" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
42
examples/options-suppressScrollAxis.html
Normal file
42
examples/options-suppressScrollAxis.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: hidden; }
|
||||
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
|
||||
.spacer { text-align:center }
|
||||
h2 { text-align: center; }
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
$('#Default').perfectScrollbar();
|
||||
$('#SuppressScrollX').perfectScrollbar({suppressScrollX: true});
|
||||
$('#SuppressScrollY').perfectScrollbar({suppressScrollY: true});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Default</h2>
|
||||
<div id="Default" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
<h2>suppressScrollX: true</h2>
|
||||
<div id="SuppressScrollX" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
<h2>suppressScrollY: true</h2>
|
||||
<div id="SuppressScrollY" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
41
examples/options-useBothWheelAxes.html
Normal file
41
examples/options-useBothWheelAxes.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 640px; height: 360px; overflow: hidden; }
|
||||
.contentHolder .content-x { background-image: url('./azusa.jpg'); width: 1920px; height: 360px; }
|
||||
.contentHolder .content-y { background-image: url('./azusa.jpg'); width: 640px; height: 1080px; }
|
||||
.spacer { text-align:center; }
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
$('#Default').perfectScrollbar();
|
||||
$('#CanScrollWithYAxis').perfectScrollbar({useBothWheelAxes: true});
|
||||
$('#CanScrollWithXAxis').perfectScrollbar({useBothWheelAxes: true});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Default.</h1>
|
||||
<div id="Default" class="contentHolder">
|
||||
<div class="content-x">
|
||||
</div>
|
||||
</div>
|
||||
<h1 style="text-align:center">Can scroll X axis with Y axis wheel.</h1>
|
||||
<div id="CanScrollWithYAxis" class="contentHolder">
|
||||
<div class="content-x">
|
||||
</div>
|
||||
</div>
|
||||
<h1 style="text-align:center">Can scroll Y axis with X axis wheel.</h1>
|
||||
<div id="CanScrollWithXAxis" class="contentHolder">
|
||||
<div class="content-y">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
39
examples/options-wheelPropagation.html
Normal file
39
examples/options-wheelPropagation.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: hidden; }
|
||||
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
|
||||
.spacer { text-align:center }
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
$('#Default').perfectScrollbar();
|
||||
$('#NoWheelPropagation').perfectScrollbar({wheelPropagation:true});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Default; wheelPropagation:false</h1>
|
||||
<div id="Default" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
<h1 style="text-align:center">wheelPropagation:true</h1>
|
||||
<div id="NoWheelPropagation" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
<div class="spacer">
|
||||
Note<br>that<br>there<br>is<br>plenty<br>of<br>text<br>after<br>the<br>image<br>to<br>ensure<br>that<br>it<br>is<br>possible<br>to<br>down<br>
|
||||
after<br>the<br>bottom<br>of<br>the<br>image<br>has<br>been<br>reached<br>to<br>enable<br>the<br>wheel<br>propagation<br>to<br>be<br>tested<br>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
41
examples/options-wheelSpeed.html
Normal file
41
examples/options-wheelSpeed.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: hidden; }
|
||||
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
|
||||
.spacer { text-align:center }
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
$('#Default').perfectScrollbar();
|
||||
$('#FastWheelSpeed').perfectScrollbar({wheelSpeed:10});
|
||||
$('#SlowWheelSpeed').perfectScrollbar({wheelSpeed:0.1});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Default; wheelSpeed:1</h1>
|
||||
<div id="Default" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
<h1 style="text-align:center">Fast: wheelSpeed:10</h1>
|
||||
<div id="FastWheelSpeed" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
<h1 style="text-align:center">Slow: wheelSpeed:0.1</h1>
|
||||
<div id="SlowWheelSpeed" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
56
examples/reach-the-end-callback.html
Normal file
56
examples/reach-the-end-callback.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
#description {
|
||||
border: 1px solid gray;
|
||||
height:150px;
|
||||
width: 400px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
#status {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function ($) {
|
||||
var $container = $('#description');
|
||||
var $status = $('#status');
|
||||
$container.perfectScrollbar();
|
||||
$container.scroll(function(e) {
|
||||
if($container.scrollTop() === 0) {
|
||||
$status.text('it reaches the top!');
|
||||
}
|
||||
else if ($container.scrollTop() === $container.prop('scrollHeight') - $container.height()) {
|
||||
$status.text('it reaches the end!');
|
||||
} else {
|
||||
$status.text('');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="description" class="wrapper">
|
||||
<p>Hello, world! 0</p>
|
||||
<p>Hello, world! 1</p>
|
||||
<p>Hello, world! 2</p>
|
||||
<p>Hello, world! 3</p>
|
||||
<p>Hello, world! 4</p>
|
||||
<p>Hello, world! 5</p>
|
||||
<p>Hello, world! 6</p>
|
||||
<p>Hello, world! 7</p>
|
||||
<p>Hello, world! 8</p>
|
||||
<p>Hello, world! 9</p>
|
||||
</div>
|
||||
<div id="status">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
29
examples/rtl.html
Normal file
29
examples/rtl.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: hidden; }
|
||||
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
|
||||
.spacer { text-align:center }
|
||||
|
||||
html { direction: rtl; }
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
$('#Default').perfectScrollbar();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="Default" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
38
examples/scrollbars-on-the-opposite-side.html
Normal file
38
examples/scrollbars-on-the-opposite-side.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
.contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: hidden; }
|
||||
.contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
|
||||
.spacer { text-align:center }
|
||||
|
||||
/* Change the alignment of scrollbars */
|
||||
/* Recommended: You can just modify the CSS file directly. */
|
||||
.ps-container .ps-scrollbar-x-rail {
|
||||
top: 3px;
|
||||
bottom: auto; /* If using `top`, there shouldn't be a `bottom`. */
|
||||
}
|
||||
.ps-container .ps-scrollbar-y-rail {
|
||||
left: 3px;
|
||||
right: auto; /* If using `left`, there shouldn't be a `right`. */
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
"use strict";
|
||||
$('#Default').perfectScrollbar();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="Default" class="contentHolder">
|
||||
<div class="content">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
41
examples/text-content.html
Normal file
41
examples/text-content.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
|
||||
<title>perfect-scrollbar example</title>
|
||||
<link href="../src/perfect-scrollbar.css" rel="stylesheet">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../src/perfect-scrollbar.js"></script>
|
||||
<style>
|
||||
#description {
|
||||
border: 1px solid gray;
|
||||
height:150px;
|
||||
width: 400px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function ($) {
|
||||
$('#description').perfectScrollbar();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="description" class="wrapper">
|
||||
<div>
|
||||
<p>The command takes options applicable</p>
|
||||
<p>The command takes options applicable</p>
|
||||
<p>The command takes options applicable</p>
|
||||
<p>The command takes options applicable</p>
|
||||
<p>The command takes options applicable</p>
|
||||
<p>The command takes options applicable</p>
|
||||
<p>The command takes options applicable</p>
|
||||
<p>The command takes options applicable</p>
|
||||
<p>The command takes options applicable</p>
|
||||
<p>The command takes options applicable</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
6
min/perfect-scrollbar.min.css
vendored
6
min/perfect-scrollbar.min.css
vendored
@@ -1 +1,5 @@
|
||||
.ps-container .ps-scrollbar-x{position:absolute;bottom:3px;height:8px;background-color:#aaa;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;opacity:0;filter:alpha(opacity=0);-webkit-transition:opacity.2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.ps-container:hover .ps-scrollbar-x{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-x:hover{opacity:.9;filter:alpha(opacity=90);cursor:default}.ps-container .ps-scrollbar-x.in-scrolling{opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y{position:absolute;right:3px;width:8px;background-color:#aaa;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;opacity:0;-webkit-transition:opacity.2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.ps-container:hover .ps-scrollbar-y{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-y:hover{opacity:.9;filter:alpha(opacity=90);cursor:default}.ps-container .ps-scrollbar-y.in-scrolling{opacity:.9;filter:alpha(opacity=90)}
|
||||
/*! perfect-scrollbar - v0.5.3
|
||||
* http://noraesae.github.com/perfect-scrollbar/
|
||||
* Copyright (c) 2014 Hyunje Alex Jun; Licensed MIT */
|
||||
|
||||
.ps-container .ps-scrollbar-x-rail{position:absolute;bottom:3px;height:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-x-rail,.ps-container.hover .ps-scrollbar-x-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-x-rail:hover,.ps-container .ps-scrollbar-x-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail{position:absolute;right:3px;width:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-y-rail,.ps-container.hover .ps-scrollbar-y-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-y-rail:hover,.ps-container .ps-scrollbar-y-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x{position:absolute;bottom:0;height:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container .ps-scrollbar-x-rail:hover .ps-scrollbar-x,.ps-container .ps-scrollbar-x-rail.hover .ps-scrollbar-x{background-color:#999}.ps-container .ps-scrollbar-y{position:absolute;right:0;width:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container .ps-scrollbar-y-rail:hover .ps-scrollbar-y,.ps-container .ps-scrollbar-y-rail.hover .ps-scrollbar-y{background-color:#999}
|
||||
7
min/perfect-scrollbar.min.js
vendored
7
min/perfect-scrollbar.min.js
vendored
File diff suppressed because one or more lines are too long
20
package.json
Normal file
20
package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "perfect-scrollbar",
|
||||
"version": "0.5.3",
|
||||
"main": "src/perfect-scrollbar.js",
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-bump": "0.0.16",
|
||||
"grunt-contrib-clean": "~0.4.1",
|
||||
"grunt-contrib-csslint": "~0.1.2",
|
||||
"grunt-contrib-cssmin": "~0.6.1",
|
||||
"grunt-contrib-jshint": "~0.1.1",
|
||||
"grunt-contrib-uglify": "~0.1.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt travis --verbose"
|
||||
}
|
||||
}
|
||||
37
perfect-scrollbar.jquery.json
Normal file
37
perfect-scrollbar.jquery.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "perfect-scrollbar",
|
||||
"title": "perfect-scrollbar",
|
||||
"description": "Tiny but perfect jquery scrollbar plugin.",
|
||||
"version": "0.5.3",
|
||||
"author": {
|
||||
"name": "Hyunje Alex Jun",
|
||||
"email": "me@noraesae.net",
|
||||
"url": "https://github.com/noraesae/"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/noraesae/perfect-scrollbar#license"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": ">=1.10"
|
||||
},
|
||||
"keywords": [
|
||||
"ui",
|
||||
"scroll",
|
||||
"scrollbar"
|
||||
],
|
||||
"homepage": "http://noraesae.github.com/perfect-scrollbar/",
|
||||
"docs": "https://github.com/noraesae/perfect-scrollbar/",
|
||||
"download": "http://noraesae.github.com/perfect-scrollbar/",
|
||||
"demo": "http://noraesae.github.com/perfect-scrollbar/",
|
||||
"bugs": "https://github.com/noraesae/perfect-scrollbar/issues/",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Hyunje Alex Jun",
|
||||
"email": "me@noraesae.net",
|
||||
"url": "https://github.com/noraesae/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,60 +1,105 @@
|
||||
.ps-container .ps-scrollbar-x {
|
||||
.ps-container .ps-scrollbar-x-rail {
|
||||
position: absolute; /* please don't change 'position' */
|
||||
bottom: 3px; /* there must be 'bottom' for ps-scrollbar-x */
|
||||
bottom: 3px; /* there must be 'bottom' for ps-scrollbar-x-rail */
|
||||
height: 8px;
|
||||
background-color: #aaa;
|
||||
border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
-o-transition: background-color .2s linear, opacity .2s linear;
|
||||
-webkit-transition: background-color .2s linear, opacity .2s linear;
|
||||
-moz-transition: background-color .2s linear, opacity .2s linear;
|
||||
transition: background-color .2s linear, opacity .2s linear;
|
||||
}
|
||||
|
||||
.ps-container:hover .ps-scrollbar-x-rail,
|
||||
.ps-container.hover .ps-scrollbar-x-rail {
|
||||
opacity: 0.6;
|
||||
filter: alpha(opacity=60);
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-x-rail:hover,
|
||||
.ps-container .ps-scrollbar-x-rail.hover {
|
||||
background-color: #eee;
|
||||
opacity: 0.9;
|
||||
filter: alpha(opacity=90);
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-x-rail.in-scrolling {
|
||||
background-color: #eee;
|
||||
opacity: 0.9;
|
||||
filter: alpha(opacity=90);
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-y-rail {
|
||||
position: absolute; /* please don't change 'position' */
|
||||
right: 3px; /* there must be 'right' for ps-scrollbar-y-rail */
|
||||
width: 8px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity = 0);
|
||||
-webkit-transition: opacity.2s linear;
|
||||
-moz-transition: opacity .2s linear;
|
||||
transition: opacity .2s linear;
|
||||
-o-transition: background-color .2s linear, opacity .2s linear;
|
||||
-webkit-transition: background-color .2s linear, opacity .2s linear;
|
||||
-moz-transition: background-color .2s linear, opacity .2s linear;
|
||||
transition: background-color .2s linear, opacity .2s linear;
|
||||
}
|
||||
|
||||
.ps-container:hover .ps-scrollbar-x {
|
||||
.ps-container:hover .ps-scrollbar-y-rail,
|
||||
.ps-container.hover .ps-scrollbar-y-rail {
|
||||
opacity: 0.6;
|
||||
filter: alpha(opacity = 60);
|
||||
filter: alpha(opacity=60);
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-x:hover {
|
||||
.ps-container .ps-scrollbar-y-rail:hover,
|
||||
.ps-container .ps-scrollbar-y-rail.hover {
|
||||
background-color: #eee;
|
||||
opacity: 0.9;
|
||||
filter: alpha(opacity = 90);
|
||||
cursor:default;
|
||||
filter: alpha(opacity=90);
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-x.in-scrolling {
|
||||
.ps-container .ps-scrollbar-y-rail.in-scrolling {
|
||||
background-color: #eee;
|
||||
opacity: 0.9;
|
||||
filter: alpha(opacity = 90);
|
||||
filter: alpha(opacity=90);
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-x {
|
||||
position: absolute; /* please don't change 'position' */
|
||||
bottom: 0; /* there must be 'bottom' for ps-scrollbar-x */
|
||||
height: 8px;
|
||||
background-color: #aaa;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
-o-transition: background-color .2s linear;
|
||||
-webkit-transition: background-color.2s linear;
|
||||
-moz-transition: background-color .2s linear;
|
||||
transition: background-color .2s linear;
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-x-rail:hover .ps-scrollbar-x,
|
||||
.ps-container .ps-scrollbar-x-rail.hover .ps-scrollbar-x {
|
||||
background-color: #999;
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-y {
|
||||
position: absolute; /* please don't change 'position' */
|
||||
right: 3px; /* there must be 'right' for ps-scrollbar-y */
|
||||
right: 0; /* there must be 'right' for ps-scrollbar-y */
|
||||
width: 8px;
|
||||
background-color: #aaa;
|
||||
border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity.2s linear;
|
||||
-moz-transition: opacity .2s linear;
|
||||
transition: opacity .2s linear;
|
||||
border-radius: 4px;
|
||||
-o-transition: background-color .2s linear;
|
||||
-webkit-transition: background-color.2s linear;
|
||||
-moz-transition: background-color .2s linear;
|
||||
transition: background-color .2s linear;
|
||||
}
|
||||
|
||||
.ps-container:hover .ps-scrollbar-y {
|
||||
opacity: 0.6;
|
||||
filter: alpha(opacity = 60);
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-y:hover {
|
||||
opacity: 0.9;
|
||||
filter: alpha(opacity = 90);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ps-container .ps-scrollbar-y.in-scrolling {
|
||||
opacity: 0.9;
|
||||
filter: alpha(opacity = 90);
|
||||
.ps-container .ps-scrollbar-y-rail:hover .ps-scrollbar-y,
|
||||
.ps-container .ps-scrollbar-y-rail.hover .ps-scrollbar-y {
|
||||
background-color: #999;
|
||||
}
|
||||
|
||||
@@ -1,206 +1,707 @@
|
||||
/* Copyright (c) 2012 HyeonJe Jun (http://github.com/noraesae)
|
||||
/* Copyright (c) 2012, 2014 Hyunje Alex Jun and other contributors
|
||||
* Licensed under the MIT License
|
||||
*/
|
||||
((function($) {
|
||||
$.fn.perfectScrollbar = function(option) {
|
||||
if(option === 'update') {
|
||||
if($(this).data('perfect_scrollbar_update')) {
|
||||
$(this).data('perfect_scrollbar_update')();
|
||||
}
|
||||
return $(this);
|
||||
}
|
||||
else if(option === 'destroy') {
|
||||
if($(this).data('perfect_scrollbar_destroy')) {
|
||||
$(this).data('perfect_scrollbar_destroy')();
|
||||
}
|
||||
return $(this);
|
||||
}
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
|
||||
if($(this).data('perfect_scrollbar')) {
|
||||
// if there's already perfect_scrollbar
|
||||
return $(this).data('perfect_scrollbar');
|
||||
}
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function ($) {
|
||||
'use strict';
|
||||
|
||||
var $this = $(this).addClass('ps-container'),
|
||||
$content = $(this).children(),
|
||||
$scrollbar_x = $("<div class='ps-scrollbar-x'></div>").appendTo($this),
|
||||
$scrollbar_y = $("<div class='ps-scrollbar-y'></div>").appendTo($this),
|
||||
container_width,
|
||||
container_height,
|
||||
content_width,
|
||||
content_height,
|
||||
scrollbar_x_width,
|
||||
scrollbar_x_left,
|
||||
scrollbar_x_bottom = parseInt($scrollbar_x.css('bottom')),
|
||||
scrollbar_y_height,
|
||||
scrollbar_y_top,
|
||||
scrollbar_y_right = parseInt($scrollbar_y.css('right'));
|
||||
function int(x) {
|
||||
if (typeof x === 'string') {
|
||||
return parseInt(x, 10);
|
||||
} else {
|
||||
return ~~x;
|
||||
}
|
||||
}
|
||||
|
||||
var updateContentScrollTop = function() {
|
||||
var scroll_top = parseInt(scrollbar_y_top * content_height / container_height);
|
||||
$this.scrollTop(scroll_top);
|
||||
$scrollbar_x.css({bottom: scrollbar_x_bottom - scroll_top});
|
||||
};
|
||||
var defaultSettings = {
|
||||
wheelSpeed: 1,
|
||||
wheelPropagation: false,
|
||||
minScrollbarLength: null,
|
||||
maxScrollbarLength: null,
|
||||
useBothWheelAxes: false,
|
||||
useKeyboard: true,
|
||||
suppressScrollX: false,
|
||||
suppressScrollY: false,
|
||||
scrollXMarginOffset: 0,
|
||||
scrollYMarginOffset: 0,
|
||||
includePadding: false
|
||||
};
|
||||
|
||||
var updateContentScrollLeft = function() {
|
||||
var scroll_left = parseInt(scrollbar_x_left * content_width / container_width);
|
||||
$this.scrollLeft(scroll_left);
|
||||
$scrollbar_y.css({right: scrollbar_y_right - scroll_left});
|
||||
};
|
||||
|
||||
var updateBarSizeAndPosition = function() {
|
||||
container_width = $this.width();
|
||||
container_height = $this.height();
|
||||
content_width = $content.width();
|
||||
content_height = $content.height();
|
||||
if(container_width < content_width) {
|
||||
scrollbar_x_width = parseInt(container_width * container_width / content_width);
|
||||
scrollbar_x_left = parseInt($this.scrollLeft() * container_width / content_width);
|
||||
}
|
||||
else {
|
||||
scrollbar_x_width = 0;
|
||||
scrollbar_x_left = 0;
|
||||
}
|
||||
if(container_height < content_height) {
|
||||
scrollbar_y_height = parseInt(container_height * container_height / content_height);
|
||||
scrollbar_y_top = parseInt($this.scrollTop() * container_height / content_height);
|
||||
}
|
||||
else {
|
||||
scrollbar_y_height = 0;
|
||||
scrollbar_y_left = 0;
|
||||
}
|
||||
|
||||
$scrollbar_x.css({left: scrollbar_x_left + $this.scrollLeft(), bottom: scrollbar_x_bottom - $this.scrollTop(), width: scrollbar_x_width});
|
||||
$scrollbar_y.css({top: scrollbar_y_top + $this.scrollTop(), right: scrollbar_y_right - $this.scrollLeft(), height: scrollbar_y_height});
|
||||
};
|
||||
|
||||
var moveBarX = function(current_left, delta_x) {
|
||||
var new_left = current_left + delta_x,
|
||||
max_left = container_width - scrollbar_x_width;
|
||||
|
||||
if(new_left < 0) {
|
||||
scrollbar_x_left = 0;
|
||||
}
|
||||
else if(new_left > max_left) {
|
||||
scrollbar_x_left = max_left;
|
||||
}
|
||||
else {
|
||||
scrollbar_x_left = new_left;
|
||||
}
|
||||
$scrollbar_x.css({left: scrollbar_x_left + $this.scrollLeft()});
|
||||
}
|
||||
|
||||
var moveBarY = function(current_top, delta_y) {
|
||||
var new_top = current_top + delta_y,
|
||||
max_top = container_height - scrollbar_y_height;
|
||||
|
||||
if(new_top < 0) {
|
||||
scrollbar_y_top = 0;
|
||||
}
|
||||
else if(new_top > max_top) {
|
||||
scrollbar_y_top = max_top;
|
||||
}
|
||||
else {
|
||||
scrollbar_y_top = new_top;
|
||||
}
|
||||
$scrollbar_y.css({top: scrollbar_y_top + $this.scrollTop()});
|
||||
};
|
||||
|
||||
var bindMouseScrollXHandler = function() {
|
||||
var current_left,
|
||||
current_page_x;
|
||||
|
||||
$scrollbar_x.bind('mousedown.perfect-scroll', function(e) {
|
||||
current_page_x = e.pageX;
|
||||
current_left = $scrollbar_x.position().left;
|
||||
$scrollbar_x.addClass('in-scrolling');
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(window).bind('mousemove.perfect-scroll', function(e) {
|
||||
if($scrollbar_x.hasClass('in-scrolling')) {
|
||||
moveBarX(current_left, e.pageX - current_page_x);
|
||||
updateContentScrollLeft();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$(window).bind('mouseup.perfect-scroll', function(e) {
|
||||
if($scrollbar_x.hasClass('in-scrolling')) {
|
||||
$scrollbar_x.removeClass('in-scrolling');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var bindMouseScrollYHandler = function() {
|
||||
var current_top,
|
||||
current_page_y;
|
||||
|
||||
$scrollbar_y.bind('mousedown.perfect-scroll', function(e) {
|
||||
current_page_y = e.pageY;
|
||||
current_top = $scrollbar_y.position().top;
|
||||
$scrollbar_y.addClass('in-scrolling');
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(window).bind('mousemove.perfect-scroll', function(e) {
|
||||
if($scrollbar_y.hasClass('in-scrolling')) {
|
||||
moveBarY(current_top, e.pageY - current_page_y);
|
||||
updateContentScrollTop();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$(window).bind('mouseup.perfect-scroll', function(e) {
|
||||
if($scrollbar_y.hasClass('in-scrolling')) {
|
||||
$scrollbar_y.removeClass('in-scrolling');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// bind handlers
|
||||
var bindMouseWheelHandler = function() {
|
||||
$this.mousewheel(function(e, delta, deltaX, deltaY) {
|
||||
$this.scrollTop($this.scrollTop() - (deltaY * 10));
|
||||
$this.scrollLeft($this.scrollLeft() + (deltaX * 10));
|
||||
|
||||
// update bar position
|
||||
updateBarSizeAndPosition();
|
||||
|
||||
if(content_height > container_height || content_width > container_width) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var destroy = function() {
|
||||
$scrollbar_x.remove();
|
||||
$scrollbar_y.remove();
|
||||
$this.unbind('mousewheel');
|
||||
$(window).unbind('mousemove.perfect-scroll');
|
||||
$(window).unbind('mouseup.perfect-scroll');
|
||||
$this.data('perfect_scrollbar', null);
|
||||
$this.data('perfect_scrollbar_update', null);
|
||||
$this.data('perfect_scrollbar_destroy', null);
|
||||
};
|
||||
|
||||
var initialize = function() {
|
||||
updateBarSizeAndPosition();
|
||||
bindMouseScrollXHandler();
|
||||
bindMouseScrollYHandler();
|
||||
if($this.mousewheel) bindMouseWheelHandler();
|
||||
$this.data('perfect_scrollbar', $this);
|
||||
$this.data('perfect_scrollbar_update', updateBarSizeAndPosition);
|
||||
$this.data('perfect_scrollbar_destroy', destroy);
|
||||
};
|
||||
|
||||
// initialize
|
||||
initialize();
|
||||
|
||||
return $this;
|
||||
var getEventClassName = (function () {
|
||||
var incrementingId = 0;
|
||||
return function () {
|
||||
var id = incrementingId;
|
||||
incrementingId += 1;
|
||||
return '.perfect-scrollbar-' + id;
|
||||
};
|
||||
})(jQuery));
|
||||
})();
|
||||
|
||||
$.fn.perfectScrollbar = function (suppliedSettings, option) {
|
||||
|
||||
return this.each(function () {
|
||||
var settings = $.extend(true, {}, defaultSettings);
|
||||
var $this = $(this);
|
||||
|
||||
if (typeof suppliedSettings === "object") {
|
||||
// Override default settings with any supplied
|
||||
$.extend(true, settings, suppliedSettings);
|
||||
} else {
|
||||
// If no setting was supplied, then the first param must be the option
|
||||
option = suppliedSettings;
|
||||
}
|
||||
|
||||
// Catch options
|
||||
if (option === 'update') {
|
||||
if ($this.data('perfect-scrollbar-update')) {
|
||||
$this.data('perfect-scrollbar-update')();
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
else if (option === 'destroy') {
|
||||
if ($this.data('perfect-scrollbar-destroy')) {
|
||||
$this.data('perfect-scrollbar-destroy')();
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
if ($this.data('perfect-scrollbar')) {
|
||||
// if there's already perfect-scrollbar
|
||||
return $this.data('perfect-scrollbar');
|
||||
}
|
||||
|
||||
|
||||
// Or generate new perfectScrollbar
|
||||
|
||||
$this.addClass('ps-container');
|
||||
|
||||
var containerWidth;
|
||||
var containerHeight;
|
||||
var contentWidth;
|
||||
var contentHeight;
|
||||
|
||||
var isRtl = $this.css('direction') === "rtl";
|
||||
var eventClassName = getEventClassName();
|
||||
var ownerDocument = this.ownerDocument || document;
|
||||
|
||||
var $scrollbarXRail = $("<div class='ps-scrollbar-x-rail'>").appendTo($this);
|
||||
var $scrollbarX = $("<div class='ps-scrollbar-x'>").appendTo($scrollbarXRail);
|
||||
var scrollbarXActive;
|
||||
var scrollbarXWidth;
|
||||
var scrollbarXLeft;
|
||||
var scrollbarXBottom = int($scrollbarXRail.css('bottom'));
|
||||
var isScrollbarXUsingBottom = scrollbarXBottom === scrollbarXBottom; // !isNaN
|
||||
var scrollbarXTop = isScrollbarXUsingBottom ? null : int($scrollbarXRail.css('top'));
|
||||
var railBorderXWidth = int($scrollbarXRail.css('borderLeftWidth')) + int($scrollbarXRail.css('borderRightWidth'));
|
||||
|
||||
var $scrollbarYRail = $("<div class='ps-scrollbar-y-rail'>").appendTo($this);
|
||||
var $scrollbarY = $("<div class='ps-scrollbar-y'>").appendTo($scrollbarYRail);
|
||||
var scrollbarYActive;
|
||||
var scrollbarYHeight;
|
||||
var scrollbarYTop;
|
||||
var scrollbarYRight = int($scrollbarYRail.css('right'));
|
||||
var isScrollbarYUsingRight = scrollbarYRight === scrollbarYRight; // !isNaN
|
||||
var scrollbarYLeft = isScrollbarYUsingRight ? null : int($scrollbarYRail.css('left'));
|
||||
var railBorderYWidth = int($scrollbarXRail.css('borderTopWidth')) + int($scrollbarXRail.css('borderBottomWidth'));
|
||||
|
||||
function updateScrollTop(currentTop, deltaY) {
|
||||
var newTop = currentTop + deltaY;
|
||||
var maxTop = containerHeight - scrollbarYHeight;
|
||||
|
||||
if (newTop < 0) {
|
||||
scrollbarYTop = 0;
|
||||
} else if (newTop > maxTop) {
|
||||
scrollbarYTop = maxTop;
|
||||
} else {
|
||||
scrollbarYTop = newTop;
|
||||
}
|
||||
|
||||
var scrollTop = int(scrollbarYTop * (contentHeight - containerHeight) / (containerHeight - scrollbarYHeight));
|
||||
$this.scrollTop(scrollTop);
|
||||
}
|
||||
|
||||
function updateScrollLeft(currentLeft, deltaX) {
|
||||
var newLeft = currentLeft + deltaX;
|
||||
var maxLeft = containerWidth - scrollbarXWidth;
|
||||
|
||||
if (newLeft < 0) {
|
||||
scrollbarXLeft = 0;
|
||||
} else if (newLeft > maxLeft) {
|
||||
scrollbarXLeft = maxLeft;
|
||||
} else {
|
||||
scrollbarXLeft = newLeft;
|
||||
}
|
||||
|
||||
var scrollLeft = int(scrollbarXLeft * (contentWidth - containerWidth) / (containerWidth - scrollbarXWidth));
|
||||
$this.scrollLeft(scrollLeft);
|
||||
}
|
||||
|
||||
function getThumbSize(thumbSize) {
|
||||
if (settings.minScrollbarLength) {
|
||||
thumbSize = Math.max(thumbSize, settings.minScrollbarLength);
|
||||
}
|
||||
if (settings.maxScrollbarLength) {
|
||||
thumbSize = Math.min(thumbSize, settings.maxScrollbarLength);
|
||||
}
|
||||
return thumbSize;
|
||||
}
|
||||
|
||||
function updateCss() {
|
||||
var xRailOffset = {width: containerWidth, display: scrollbarXActive ? "inherit" : "none"};
|
||||
if (isRtl) {
|
||||
xRailOffset.left = $this.scrollLeft() + containerWidth - contentWidth;
|
||||
} else {
|
||||
xRailOffset.left = $this.scrollLeft();
|
||||
}
|
||||
if (isScrollbarXUsingBottom) {
|
||||
xRailOffset.bottom = scrollbarXBottom - $this.scrollTop();
|
||||
} else {
|
||||
xRailOffset.top = scrollbarXTop + $this.scrollTop();
|
||||
}
|
||||
$scrollbarXRail.css(xRailOffset);
|
||||
|
||||
var railYOffset = {top: $this.scrollTop(), height: containerHeight, display: scrollbarYActive ? "inherit" : "none"};
|
||||
|
||||
if (isScrollbarYUsingRight) {
|
||||
if (isRtl) {
|
||||
railYOffset.right = contentWidth - $this.scrollLeft() - scrollbarYRight - $scrollbarY.outerWidth();
|
||||
} else {
|
||||
railYOffset.right = scrollbarYRight - $this.scrollLeft();
|
||||
}
|
||||
} else {
|
||||
if (isRtl) {
|
||||
railYOffset.left = $this.scrollLeft() + containerWidth * 2 - contentWidth - scrollbarYLeft - $scrollbarY.outerWidth();
|
||||
} else {
|
||||
railYOffset.left = scrollbarYLeft + $this.scrollLeft();
|
||||
}
|
||||
}
|
||||
$scrollbarYRail.css(railYOffset);
|
||||
|
||||
$scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth - railBorderXWidth});
|
||||
$scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight - railBorderYWidth});
|
||||
}
|
||||
|
||||
function updateGeometry() {
|
||||
// Hide scrollbars not to affect scrollWidth and scrollHeight
|
||||
$scrollbarXRail.hide();
|
||||
$scrollbarYRail.hide();
|
||||
|
||||
containerWidth = settings.includePadding ? $this.innerWidth() : $this.width();
|
||||
containerHeight = settings.includePadding ? $this.innerHeight() : $this.height();
|
||||
contentWidth = $this.prop('scrollWidth');
|
||||
contentHeight = $this.prop('scrollHeight');
|
||||
|
||||
if (!settings.suppressScrollX && containerWidth + settings.scrollXMarginOffset < contentWidth) {
|
||||
scrollbarXActive = true;
|
||||
scrollbarXWidth = getThumbSize(int(containerWidth * containerWidth / contentWidth));
|
||||
scrollbarXLeft = int($this.scrollLeft() * (containerWidth - scrollbarXWidth) / (contentWidth - containerWidth));
|
||||
} else {
|
||||
scrollbarXActive = false;
|
||||
scrollbarXWidth = 0;
|
||||
scrollbarXLeft = 0;
|
||||
$this.scrollLeft(0);
|
||||
}
|
||||
|
||||
if (!settings.suppressScrollY && containerHeight + settings.scrollYMarginOffset < contentHeight) {
|
||||
scrollbarYActive = true;
|
||||
scrollbarYHeight = getThumbSize(int(containerHeight * containerHeight / contentHeight));
|
||||
scrollbarYTop = int($this.scrollTop() * (containerHeight - scrollbarYHeight) / (contentHeight - containerHeight));
|
||||
} else {
|
||||
scrollbarYActive = false;
|
||||
scrollbarYHeight = 0;
|
||||
scrollbarYTop = 0;
|
||||
$this.scrollTop(0);
|
||||
}
|
||||
|
||||
if (scrollbarXLeft >= containerWidth - scrollbarXWidth) {
|
||||
scrollbarXLeft = containerWidth - scrollbarXWidth;
|
||||
}
|
||||
if (scrollbarYTop >= containerHeight - scrollbarYHeight) {
|
||||
scrollbarYTop = containerHeight - scrollbarYHeight;
|
||||
}
|
||||
|
||||
updateCss();
|
||||
|
||||
if (scrollbarXActive) {
|
||||
$this.addClass('ps-active-x');
|
||||
} else {
|
||||
$this.removeClass('ps-active-x');
|
||||
}
|
||||
|
||||
if (scrollbarYActive) {
|
||||
$this.addClass('ps-active-y');
|
||||
} else {
|
||||
$this.removeClass('ps-active-y');
|
||||
}
|
||||
|
||||
// Show scrollbars if needed after updated
|
||||
if (!settings.suppressScrollX) {
|
||||
$scrollbarXRail.show();
|
||||
}
|
||||
if (!settings.suppressScrollY) {
|
||||
$scrollbarYRail.show();
|
||||
}
|
||||
}
|
||||
|
||||
function bindMouseScrollXHandler() {
|
||||
var currentLeft;
|
||||
var currentPageX;
|
||||
|
||||
$scrollbarX.bind('mousedown' + eventClassName, function (e) {
|
||||
currentPageX = e.pageX;
|
||||
currentLeft = $scrollbarX.position().left;
|
||||
$scrollbarXRail.addClass('in-scrolling');
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(ownerDocument).bind('mousemove' + eventClassName, function (e) {
|
||||
if ($scrollbarXRail.hasClass('in-scrolling')) {
|
||||
updateScrollLeft(currentLeft, e.pageX - currentPageX);
|
||||
updateGeometry();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$(ownerDocument).bind('mouseup' + eventClassName, function (e) {
|
||||
if ($scrollbarXRail.hasClass('in-scrolling')) {
|
||||
$scrollbarXRail.removeClass('in-scrolling');
|
||||
}
|
||||
});
|
||||
|
||||
currentLeft =
|
||||
currentPageX = null;
|
||||
}
|
||||
|
||||
function bindMouseScrollYHandler() {
|
||||
var currentTop;
|
||||
var currentPageY;
|
||||
|
||||
$scrollbarY.bind('mousedown' + eventClassName, function (e) {
|
||||
currentPageY = e.pageY;
|
||||
currentTop = $scrollbarY.position().top;
|
||||
$scrollbarYRail.addClass('in-scrolling');
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(ownerDocument).bind('mousemove' + eventClassName, function (e) {
|
||||
if ($scrollbarYRail.hasClass('in-scrolling')) {
|
||||
updateScrollTop(currentTop, e.pageY - currentPageY);
|
||||
updateGeometry();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$(ownerDocument).bind('mouseup' + eventClassName, function (e) {
|
||||
if ($scrollbarYRail.hasClass('in-scrolling')) {
|
||||
$scrollbarYRail.removeClass('in-scrolling');
|
||||
}
|
||||
});
|
||||
|
||||
currentTop =
|
||||
currentPageY = null;
|
||||
}
|
||||
|
||||
// check if the default scrolling should be prevented.
|
||||
function shouldPreventDefault(deltaX, deltaY) {
|
||||
var scrollTop = $this.scrollTop();
|
||||
if (deltaX === 0) {
|
||||
if (!scrollbarYActive) {
|
||||
return false;
|
||||
}
|
||||
if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= contentHeight - containerHeight && deltaY < 0)) {
|
||||
return !settings.wheelPropagation;
|
||||
}
|
||||
}
|
||||
|
||||
var scrollLeft = $this.scrollLeft();
|
||||
if (deltaY === 0) {
|
||||
if (!scrollbarXActive) {
|
||||
return false;
|
||||
}
|
||||
if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= contentWidth - containerWidth && deltaX > 0)) {
|
||||
return !settings.wheelPropagation;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function bindMouseWheelHandler() {
|
||||
var shouldPrevent = false;
|
||||
|
||||
function getDeltaFromEvent(e) {
|
||||
var deltaX = e.originalEvent.deltaX;
|
||||
var deltaY = -1 * e.originalEvent.deltaY;
|
||||
|
||||
if (typeof deltaX === "undefined" || typeof deltaY === "undefined") {
|
||||
// OS X Safari
|
||||
deltaX = -1 * e.originalEvent.wheelDeltaX / 6;
|
||||
deltaY = e.originalEvent.wheelDeltaY / 6;
|
||||
}
|
||||
|
||||
if (e.originalEvent.deltaMode && e.originalEvent.deltaMode === 1) {
|
||||
// Firefox in deltaMode 1: Line scrolling
|
||||
deltaX *= 10;
|
||||
deltaY *= 10;
|
||||
}
|
||||
|
||||
if (deltaX !== deltaX && deltaY !== deltaY/* NaN checks */) {
|
||||
// IE in some mouse drivers
|
||||
deltaX = 0;
|
||||
deltaY = e.originalEvent.wheelDelta;
|
||||
}
|
||||
|
||||
return [deltaX, deltaY];
|
||||
}
|
||||
|
||||
function mousewheelHandler(e) {
|
||||
var delta = getDeltaFromEvent(e);
|
||||
|
||||
var deltaX = delta[0];
|
||||
var deltaY = delta[1];
|
||||
|
||||
shouldPrevent = false;
|
||||
if (!settings.useBothWheelAxes) {
|
||||
// deltaX will only be used for horizontal scrolling and deltaY will
|
||||
// only be used for vertical scrolling - this is the default
|
||||
$this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed));
|
||||
$this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed));
|
||||
} else if (scrollbarYActive && !scrollbarXActive) {
|
||||
// only vertical scrollbar is active and useBothWheelAxes option is
|
||||
// active, so let's scroll vertical bar using both mouse wheel axes
|
||||
if (deltaY) {
|
||||
$this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed));
|
||||
} else {
|
||||
$this.scrollTop($this.scrollTop() + (deltaX * settings.wheelSpeed));
|
||||
}
|
||||
shouldPrevent = true;
|
||||
} else if (scrollbarXActive && !scrollbarYActive) {
|
||||
// useBothWheelAxes and only horizontal bar is active, so use both
|
||||
// wheel axes for horizontal bar
|
||||
if (deltaX) {
|
||||
$this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed));
|
||||
} else {
|
||||
$this.scrollLeft($this.scrollLeft() - (deltaY * settings.wheelSpeed));
|
||||
}
|
||||
shouldPrevent = true;
|
||||
}
|
||||
|
||||
updateGeometry();
|
||||
|
||||
shouldPrevent = (shouldPrevent || shouldPreventDefault(deltaX, deltaY));
|
||||
if (shouldPrevent) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof window.onwheel !== "undefined") {
|
||||
$this.bind('wheel' + eventClassName, mousewheelHandler);
|
||||
} else if (typeof window.onmousewheel !== "undefined") {
|
||||
$this.bind('mousewheel' + eventClassName, mousewheelHandler);
|
||||
}
|
||||
}
|
||||
|
||||
function bindKeyboardHandler() {
|
||||
var hovered = false;
|
||||
$this.bind('mouseenter' + eventClassName, function (e) {
|
||||
hovered = true;
|
||||
});
|
||||
$this.bind('mouseleave' + eventClassName, function (e) {
|
||||
hovered = false;
|
||||
});
|
||||
|
||||
var shouldPrevent = false;
|
||||
$(ownerDocument).bind('keydown' + eventClassName, function (e) {
|
||||
if (e.isDefaultPrevented && e.isDefaultPrevented()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hovered) {
|
||||
return;
|
||||
}
|
||||
|
||||
var activeElement = document.activeElement ? document.activeElement : ownerDocument.activeElement;
|
||||
// go deeper if element is a webcomponent
|
||||
while (activeElement.shadowRoot) {
|
||||
activeElement = activeElement.shadowRoot.activeElement;
|
||||
}
|
||||
if ($(activeElement).is(":input,[contenteditable]")) {
|
||||
return;
|
||||
}
|
||||
|
||||
var deltaX = 0;
|
||||
var deltaY = 0;
|
||||
|
||||
switch (e.which) {
|
||||
case 37: // left
|
||||
deltaX = -30;
|
||||
break;
|
||||
case 38: // up
|
||||
deltaY = 30;
|
||||
break;
|
||||
case 39: // right
|
||||
deltaX = 30;
|
||||
break;
|
||||
case 40: // down
|
||||
deltaY = -30;
|
||||
break;
|
||||
case 33: // page up
|
||||
deltaY = 90;
|
||||
break;
|
||||
case 32: // space bar
|
||||
case 34: // page down
|
||||
deltaY = -90;
|
||||
break;
|
||||
case 35: // end
|
||||
if (e.ctrlKey) {
|
||||
deltaY = -contentHeight;
|
||||
} else {
|
||||
deltaY = -containerHeight;
|
||||
}
|
||||
break;
|
||||
case 36: // home
|
||||
if (e.ctrlKey) {
|
||||
deltaY = $this.scrollTop();
|
||||
} else {
|
||||
deltaY = containerHeight;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
$this.scrollTop($this.scrollTop() - deltaY);
|
||||
$this.scrollLeft($this.scrollLeft() + deltaX);
|
||||
|
||||
shouldPrevent = shouldPreventDefault(deltaX, deltaY);
|
||||
if (shouldPrevent) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bindRailClickHandler() {
|
||||
function stopPropagation(e) { e.stopPropagation(); }
|
||||
|
||||
$scrollbarY.bind('click' + eventClassName, stopPropagation);
|
||||
$scrollbarYRail.bind('click' + eventClassName, function (e) {
|
||||
var halfOfScrollbarLength = int(scrollbarYHeight / 2);
|
||||
var positionTop = e.pageY - $scrollbarYRail.offset().top - halfOfScrollbarLength;
|
||||
var maxPositionTop = containerHeight - scrollbarYHeight;
|
||||
var positionRatio = positionTop / maxPositionTop;
|
||||
|
||||
if (positionRatio < 0) {
|
||||
positionRatio = 0;
|
||||
} else if (positionRatio > 1) {
|
||||
positionRatio = 1;
|
||||
}
|
||||
|
||||
$this.scrollTop((contentHeight - containerHeight) * positionRatio);
|
||||
});
|
||||
|
||||
$scrollbarX.bind('click' + eventClassName, stopPropagation);
|
||||
$scrollbarXRail.bind('click' + eventClassName, function (e) {
|
||||
var halfOfScrollbarLength = int(scrollbarXWidth / 2);
|
||||
var positionLeft = e.pageX - $scrollbarXRail.offset().left - halfOfScrollbarLength;
|
||||
var maxPositionLeft = containerWidth - scrollbarXWidth;
|
||||
var positionRatio = positionLeft / maxPositionLeft;
|
||||
|
||||
if (positionRatio < 0) {
|
||||
positionRatio = 0;
|
||||
} else if (positionRatio > 1) {
|
||||
positionRatio = 1;
|
||||
}
|
||||
|
||||
$this.scrollLeft((contentWidth - containerWidth) * positionRatio);
|
||||
});
|
||||
}
|
||||
|
||||
function bindTouchHandler() {
|
||||
function applyTouchMove(differenceX, differenceY) {
|
||||
$this.scrollTop($this.scrollTop() - differenceY);
|
||||
$this.scrollLeft($this.scrollLeft() - differenceX);
|
||||
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
var startOffset = {};
|
||||
var startTime = 0;
|
||||
var speed = {};
|
||||
var breakingProcess = null;
|
||||
var inGlobalTouch = false;
|
||||
|
||||
function globalTouchStart(e) {
|
||||
inGlobalTouch = true;
|
||||
}
|
||||
function globalTouchEnd(e) {
|
||||
inGlobalTouch = false;
|
||||
}
|
||||
|
||||
function getTouch(e) {
|
||||
if (e.originalEvent.targetTouches) {
|
||||
return e.originalEvent.targetTouches[0];
|
||||
} else {
|
||||
// Maybe IE pointer
|
||||
return e.originalEvent;
|
||||
}
|
||||
}
|
||||
function touchStart(e) {
|
||||
var touch = getTouch(e);
|
||||
|
||||
startOffset.pageX = touch.pageX;
|
||||
startOffset.pageY = touch.pageY;
|
||||
|
||||
startTime = (new Date()).getTime();
|
||||
|
||||
if (breakingProcess !== null) {
|
||||
clearInterval(breakingProcess);
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
}
|
||||
function touchMove(e) {
|
||||
if (!inGlobalTouch && e.originalEvent.targetTouches.length === 1) {
|
||||
var touch = getTouch(e);
|
||||
|
||||
var currentOffset = {pageX: touch.pageX, pageY: touch.pageY};
|
||||
|
||||
var differenceX = currentOffset.pageX - startOffset.pageX;
|
||||
var differenceY = currentOffset.pageY - startOffset.pageY;
|
||||
|
||||
applyTouchMove(differenceX, differenceY);
|
||||
startOffset = currentOffset;
|
||||
|
||||
var currentTime = (new Date()).getTime();
|
||||
|
||||
var timeGap = currentTime - startTime;
|
||||
if (timeGap > 0) {
|
||||
speed.x = differenceX / timeGap;
|
||||
speed.y = differenceY / timeGap;
|
||||
startTime = currentTime;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
function touchEnd(e) {
|
||||
clearInterval(breakingProcess);
|
||||
breakingProcess = setInterval(function () {
|
||||
if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
|
||||
clearInterval(breakingProcess);
|
||||
return;
|
||||
}
|
||||
|
||||
applyTouchMove(speed.x * 30, speed.y * 30);
|
||||
|
||||
speed.x *= 0.8;
|
||||
speed.y *= 0.8;
|
||||
}, 10);
|
||||
}
|
||||
|
||||
$(window).bind("touchstart" + eventClassName, globalTouchStart);
|
||||
$(window).bind("touchend" + eventClassName, globalTouchEnd);
|
||||
$this.bind("touchstart" + eventClassName, touchStart);
|
||||
$this.bind("touchmove" + eventClassName, touchMove);
|
||||
$this.bind("touchend" + eventClassName, touchEnd);
|
||||
|
||||
if (window.PointerEvent) {
|
||||
$(window).bind("pointerdown" + eventClassName, globalTouchStart);
|
||||
$(window).bind("pointerup" + eventClassName, globalTouchEnd);
|
||||
$this.bind("pointerdown" + eventClassName, touchStart);
|
||||
$this.bind("pointermove" + eventClassName, touchMove);
|
||||
$this.bind("pointerup" + eventClassName, touchEnd);
|
||||
} else if (window.MSPointerEvent) {
|
||||
$(window).bind("MSPointerDown" + eventClassName, globalTouchStart);
|
||||
$(window).bind("MSPointerUp" + eventClassName, globalTouchEnd);
|
||||
$this.bind("MSPointerDown" + eventClassName, touchStart);
|
||||
$this.bind("MSPointerMove" + eventClassName, touchMove);
|
||||
$this.bind("MSPointerUp" + eventClassName, touchEnd);
|
||||
}
|
||||
}
|
||||
|
||||
function bindScrollHandler() {
|
||||
$this.bind('scroll' + eventClassName, function (e) {
|
||||
updateGeometry();
|
||||
});
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
$this.unbind(eventClassName);
|
||||
$(window).unbind(eventClassName);
|
||||
$(ownerDocument).unbind(eventClassName);
|
||||
$this.data('perfect-scrollbar', null);
|
||||
$this.data('perfect-scrollbar-update', null);
|
||||
$this.data('perfect-scrollbar-destroy', null);
|
||||
$scrollbarX.remove();
|
||||
$scrollbarY.remove();
|
||||
$scrollbarXRail.remove();
|
||||
$scrollbarYRail.remove();
|
||||
|
||||
// clean all variables
|
||||
$scrollbarXRail =
|
||||
$scrollbarYRail =
|
||||
$scrollbarX =
|
||||
$scrollbarY =
|
||||
scrollbarXActive =
|
||||
scrollbarYActive =
|
||||
containerWidth =
|
||||
containerHeight =
|
||||
contentWidth =
|
||||
contentHeight =
|
||||
scrollbarXWidth =
|
||||
scrollbarXLeft =
|
||||
scrollbarXBottom =
|
||||
isScrollbarXUsingBottom =
|
||||
scrollbarXTop =
|
||||
scrollbarYHeight =
|
||||
scrollbarYTop =
|
||||
scrollbarYRight =
|
||||
isScrollbarYUsingRight =
|
||||
scrollbarYLeft =
|
||||
isRtl =
|
||||
eventClassName = null;
|
||||
}
|
||||
|
||||
var supportsTouch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch);
|
||||
var supportsIePointer = window.navigator.msMaxTouchPoints !== null;
|
||||
|
||||
function initialize() {
|
||||
updateGeometry();
|
||||
bindScrollHandler();
|
||||
bindMouseScrollXHandler();
|
||||
bindMouseScrollYHandler();
|
||||
bindRailClickHandler();
|
||||
bindMouseWheelHandler();
|
||||
|
||||
if (supportsTouch || supportsIePointer) {
|
||||
bindTouchHandler();
|
||||
}
|
||||
if (settings.useKeyboard) {
|
||||
bindKeyboardHandler();
|
||||
}
|
||||
$this.data('perfect-scrollbar', $this);
|
||||
$this.data('perfect-scrollbar-update', updateGeometry);
|
||||
$this.data('perfect-scrollbar-destroy', destroy);
|
||||
}
|
||||
|
||||
initialize();
|
||||
|
||||
return $this;
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user