From 158b113d18e66615f0d0a2a11ef6d96474ad5ea3 Mon Sep 17 00:00:00 2001 From: Dan Maglasang Date: Wed, 22 Jul 2015 22:43:38 -0400 Subject: [PATCH] Allow the clicking of a rail to propagate --- src/js/plugin/default-setting.js | 3 ++- src/js/plugin/handler/click-rail.js | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/plugin/default-setting.js b/src/js/plugin/default-setting.js index 86eaf3e..c75c0ae 100644 --- a/src/js/plugin/default-setting.js +++ b/src/js/plugin/default-setting.js @@ -14,5 +14,6 @@ module.exports = { suppressScrollX: false, suppressScrollY: false, scrollXMarginOffset: 0, - scrollYMarginOffset: 0 + scrollYMarginOffset: 0, + stopPropagationOnClick: true }; diff --git a/src/js/plugin/handler/click-rail.js b/src/js/plugin/handler/click-rail.js index 971fa72..ddb7d74 100644 --- a/src/js/plugin/handler/click-rail.js +++ b/src/js/plugin/handler/click-rail.js @@ -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);