From bfa7621d9bc4a3a9cca828df3f629abbd96c62f9 Mon Sep 17 00:00:00 2001 From: Noel Delgado Date: Tue, 23 Jun 2015 03:12:14 -0500 Subject: [PATCH] fix #9 / better support for scrollbars with offset positions --- CHANGELOG.md | 6 ++++++ bower.json | 2 +- gemini-scrollbar.css | 2 +- index.js | 10 +++++----- package.json | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90d76ef..933d7d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.2.6 (2015-06-23) + +Bugfixes: + +- [#9](../../issues/9) better support for scrollbars with offset positions + ## 1.2.5 (2015-06-21) Bugfixes: diff --git a/bower.json b/bower.json index 213bab8..d135f1f 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "gemini-scrollbar", "main": "index.js", - "version": "1.2.5", + "version": "1.2.6", "homepage": "https://github.com/noeldelgado/gemini-scrollbar", "authors": [ "Noel Delgado " diff --git a/gemini-scrollbar.css b/gemini-scrollbar.css index 4e05cbd..5af9e6a 100644 --- a/gemini-scrollbar.css +++ b/gemini-scrollbar.css @@ -1,6 +1,6 @@ /** * gemini-scrollbar - * @version 1.2.5 + * @version 1.2.6 * @link http://noeldelgado.github.io/gemini-scrollbar/ * @license MIT */ diff --git a/index.js b/index.js index d36311b..b170fdc 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ /** * gemini-scrollbar - * @version 1.2.5 + * @version 1.2.6 * @link http://noeldelgado.github.io/gemini-scrollbar/ * @license MIT */ @@ -244,7 +244,7 @@ GeminiScrollbar.prototype._clickVerticalTrackHandler = function(e) { var offset = Math.abs(e.target.getBoundingClientRect().top - e.clientY); var thumbHalf = (this._thumbVerticalElement.offsetHeight / 2); - var thumbPositionPercentage = ((offset - thumbHalf) * 100 / this._viewElement.clientHeight); + var thumbPositionPercentage = ((offset - thumbHalf) * 100 / this._scrollbarVerticalElement.offsetHeight); this._viewElement.scrollTop = (thumbPositionPercentage * this._viewElement.scrollHeight / 100); }; @@ -252,7 +252,7 @@ GeminiScrollbar.prototype._clickHorizontalTrackHandler = function(e) { var offset = Math.abs(e.target.getBoundingClientRect().left - e.clientX); var thumbHalf = (this._thumbHorizontalElement.offsetWidth / 2); - var thumbPositionPercentage = ((offset - thumbHalf) * 100 / this._viewElement.clientWidth); + var thumbPositionPercentage = ((offset - thumbHalf) * 100 / this._scrollbarHorizontalElement.offsetWidth); this._viewElement.scrollLeft = (thumbPositionPercentage * this._viewElement.scrollWidth / 100); }; @@ -294,7 +294,7 @@ if (this._prevPageY) { offset = ((this._scrollbarVerticalElement.getBoundingClientRect().top - e.clientY) * -1); thumbClickPosition = (this._thumbVerticalElement.offsetHeight - this._prevPageY); - thumbPositionPercentage = ((offset - thumbClickPosition) * 100 / this._viewElement.clientHeight); + thumbPositionPercentage = ((offset - thumbClickPosition) * 100 / this._scrollbarVerticalElement.offsetHeight); this._viewElement.scrollTop = (thumbPositionPercentage * this._viewElement.scrollHeight / 100); @@ -304,7 +304,7 @@ if (this._prevPageX) { offset = ((this._scrollbarHorizontalElement.getBoundingClientRect().left - e.clientX) * -1); thumbClickPosition = (this._thumbHorizontalElement.offsetWidth - this._prevPageX); - thumbPositionPercentage = ((offset - thumbClickPosition) * 100 / this._viewElement.clientWidth); + thumbPositionPercentage = ((offset - thumbClickPosition) * 100 / this._scrollbarHorizontalElement.offsetWidth); this._viewElement.scrollLeft = (thumbPositionPercentage * this._viewElement.scrollWidth / 100); } diff --git a/package.json b/package.json index e6390fd..8af7e3d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gemini-scrollbar", - "version": "1.2.5", + "version": "1.2.6", "description": "Custom scrollbars with native scrolling", "license": "MIT", "repository": "noeldelgado/gemini-scrollbar.git",