Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7cf8303b30 | ||
|
|
7dd6335965 | ||
|
|
494d68fe02 | ||
|
|
3dde3ebb0c | ||
|
|
12086573fc |
12
README.md
12
README.md
@@ -44,14 +44,20 @@ You can download the latest stable version with download links in [Github 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
|
||||
$ 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
|
||||
$ bower install perfect-scrollbar
|
||||
```
|
||||
|
||||
It's registered on [npm](https://www.npmjs.org/package/perfect-scrollbar) as `perfect-scrollbar`.
|
||||
|
||||
```
|
||||
$ npm 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).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "perfect-scrollbar",
|
||||
"version": "0.5.4",
|
||||
"version": "0.5.5",
|
||||
"homepage": "http://noraesae.github.io/perfect-scrollbar/",
|
||||
"authors": [
|
||||
"Hyunje Alex Jun <me@noraesae.net>"
|
||||
|
||||
2
min/perfect-scrollbar.min.css
vendored
2
min/perfect-scrollbar.min.css
vendored
@@ -1,4 +1,4 @@
|
||||
/*! perfect-scrollbar - v0.5.4
|
||||
/*! perfect-scrollbar - v0.5.5
|
||||
* http://noraesae.github.com/perfect-scrollbar/
|
||||
* Copyright (c) 2014 Hyunje Alex Jun; Licensed MIT */
|
||||
|
||||
|
||||
4
min/perfect-scrollbar.min.js
vendored
4
min/perfect-scrollbar.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "perfect-scrollbar",
|
||||
"version": "0.5.4",
|
||||
"version": "0.5.5",
|
||||
"description": "Tiny but perfect jquery scrollbar plugin.",
|
||||
"author": "Hyunje Alex Jun <me@noraesae.net>",
|
||||
"contributors": [{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "perfect-scrollbar",
|
||||
"title": "perfect-scrollbar",
|
||||
"description": "Tiny but perfect jquery scrollbar plugin.",
|
||||
"version": "0.5.4",
|
||||
"version": "0.5.5",
|
||||
"author": {
|
||||
"name": "Hyunje Alex Jun",
|
||||
"email": "me@noraesae.net",
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
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'));
|
||||
var railBorderYWidth = int($scrollbarYRail.css('borderTopWidth')) + int($scrollbarYRail.css('borderBottomWidth'));
|
||||
|
||||
function updateScrollTop(currentTop, deltaY) {
|
||||
var newTop = currentTop + deltaY;
|
||||
@@ -544,6 +544,7 @@
|
||||
var speed = {};
|
||||
var breakingProcess = null;
|
||||
var inGlobalTouch = false;
|
||||
var inLocalTouch = false;
|
||||
|
||||
function globalTouchStart(e) {
|
||||
inGlobalTouch = true;
|
||||
@@ -560,23 +561,37 @@
|
||||
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);
|
||||
function shouldHandle(e) {
|
||||
var event = e.originalEvent;
|
||||
if (event.targetTouches && event.targetTouches.length === 1) {
|
||||
return true;
|
||||
}
|
||||
if (event.pointerType && event.pointerType !== 'mouse') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function touchStart(e) {
|
||||
if (shouldHandle(e)) {
|
||||
inLocalTouch = true;
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
var touch = getTouch(e);
|
||||
|
||||
startOffset.pageX = touch.pageX;
|
||||
startOffset.pageY = touch.pageY;
|
||||
|
||||
startTime = (new Date()).getTime();
|
||||
|
||||
if (breakingProcess !== null) {
|
||||
clearInterval(breakingProcess);
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
function touchMove(e) {
|
||||
if (!inGlobalTouch && e.originalEvent.targetTouches.length === 1) {
|
||||
if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) {
|
||||
var touch = getTouch(e);
|
||||
|
||||
var currentOffset = {pageX: touch.pageX, pageY: touch.pageY};
|
||||
@@ -601,18 +616,22 @@
|
||||
}
|
||||
}
|
||||
function touchEnd(e) {
|
||||
clearInterval(breakingProcess);
|
||||
breakingProcess = setInterval(function () {
|
||||
if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
|
||||
clearInterval(breakingProcess);
|
||||
return;
|
||||
}
|
||||
if (!inGlobalTouch && inLocalTouch) {
|
||||
inLocalTouch = false;
|
||||
|
||||
applyTouchMove(speed.x * 30, speed.y * 30);
|
||||
clearInterval(breakingProcess);
|
||||
breakingProcess = setInterval(function () {
|
||||
if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
|
||||
clearInterval(breakingProcess);
|
||||
return;
|
||||
}
|
||||
|
||||
speed.x *= 0.8;
|
||||
speed.y *= 0.8;
|
||||
}, 10);
|
||||
applyTouchMove(speed.x * 30, speed.y * 30);
|
||||
|
||||
speed.x *= 0.8;
|
||||
speed.y *= 0.8;
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
|
||||
if (supportsTouch) {
|
||||
|
||||
Reference in New Issue
Block a user