Skip to content

Commit

Permalink
fix #9 / better support for scrollbars with offset positions
Browse files Browse the repository at this point in the history
  • Loading branch information
noeldelgado committed Jun 23, 2015
1 parent e9af337 commit bfa7621
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion gemini-scrollbar.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* gemini-scrollbar
* @version 1.2.5
* @version 1.2.6
* @link http://noeldelgado.github.io/gemini-scrollbar/
* @license MIT
*/
Expand Down
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* gemini-scrollbar
* @version 1.2.5
* @version 1.2.6
* @link http://noeldelgado.github.io/gemini-scrollbar/
* @license MIT
*/
Expand Down Expand Up @@ -244,15 +244,15 @@
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);
};

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);
};
Expand Down Expand Up @@ -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);

Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit bfa7621

Please sign in to comment.