Compare commits

...

7 Commits
0.6.3 ... 0.6.4

Author SHA1 Message Date
Hyunje Alex Jun
b1d7aa0e64 Release 0.6.4
1. Add null-check for instances.
2. Add 'stopPropgationOnClick' option.
2015-07-25 02:28:12 +09:00
Hyunje Alex Jun
49e39f513d Update README.md 2015-07-25 02:26:55 +09:00
Jun
89f4226778 Merge pull request #366 from dorilla/feature/stop-propagation-on-click
Allow the clicking of a rail to propagate
2015-07-25 02:23:42 +09:00
Dan Maglasang
79f4cfcf5f Update README.md 2015-07-22 22:47:33 -04:00
Dan Maglasang
158b113d18 Allow the clicking of a rail to propagate 2015-07-22 22:43:38 -04:00
Hyunje Alex Jun
6c642d8a47 Just early return instead of throwing an error for no instance. 2015-07-14 12:22:40 +09:00
Hyunje Alex Jun
f9f20eeb6f Add null-check when updating or destroying an instance.
Throw an error when an instance is not found.
2015-07-07 15:25:16 +09:00
6 changed files with 21 additions and 4 deletions

View File

@@ -308,6 +308,10 @@ The number of pixels the content width can surpass the container width without e
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**
### stopPropagationOnClick
When set to false, when clicking on a rail, the click event will be allowed to propagate.
**Default: true**
## Contribution
#### Please read [Contributing](https://github.com/noraesae/perfect-scrollbar/wiki/Contributing) in the wiki before making any contribution.

View File

@@ -1,6 +1,6 @@
{
"name": "perfect-scrollbar",
"version": "0.6.3",
"version": "0.6.4",
"description": "Minimalistic but perfect custom scrollbar plugin",
"author": "Hyunje Alex Jun <me@noraesae.net>",
"contributors": [

View File

@@ -14,5 +14,6 @@ module.exports = {
suppressScrollX: false,
suppressScrollY: false,
scrollXMarginOffset: 0,
scrollYMarginOffset: 0
scrollYMarginOffset: 0,
stopPropagationOnClick: true
};

View File

@@ -10,6 +10,10 @@ var d = require('../lib/dom')
module.exports = function (element) {
var i = instances.get(element);
if (!i) {
return;
}
i.event.unbindAll();
d.remove(i.scrollbarX);
d.remove(i.scrollbarY);

View File

@@ -13,7 +13,9 @@ function bindClickRailHandler(element, i) {
}
var stopPropagation = window.Event.prototype.stopPropagation.bind;
i.event.bind(i.scrollbarY, 'click', stopPropagation);
if (i.settings.stopPropagationOnClick) {
i.event.bind(i.scrollbarY, 'click', stopPropagation);
}
i.event.bind(i.scrollbarYRail, 'click', function (e) {
var halfOfScrollbarLength = h.toInt(i.scrollbarYHeight / 2);
var positionTop = i.railYRatio * (e.pageY - window.scrollY - pageOffset(i.scrollbarYRail).top - halfOfScrollbarLength);
@@ -32,7 +34,9 @@ function bindClickRailHandler(element, i) {
e.stopPropagation();
});
i.event.bind(i.scrollbarX, 'click', stopPropagation);
if (i.settings.stopPropagationOnClick) {
i.event.bind(i.scrollbarX, 'click', stopPropagation);
}
i.event.bind(i.scrollbarXRail, 'click', function (e) {
var halfOfScrollbarLength = h.toInt(i.scrollbarXWidth / 2);
var positionLeft = i.railXRatio * (e.pageX - window.scrollX - pageOffset(i.scrollbarXRail).left - halfOfScrollbarLength);

View File

@@ -11,6 +11,10 @@ var d = require('../lib/dom')
module.exports = function (element) {
var i = instances.get(element);
if (!i) {
return;
}
// Recalcuate negative scrollLeft adjustment
i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0;