diff --git a/index.js b/index.js index b514fc1..046ced6 100644 --- a/index.js +++ b/index.js @@ -66,6 +66,8 @@ this.forceGemini = false; this.onResize = null; this.minThumbSize = 20; + this.offsetX = 0; + this.offsetY = 0; Object.keys(config || {}).forEach(function (propertyName) { this[propertyName] = config[propertyName]; @@ -213,8 +215,8 @@ return this; } - this._viewElement.style.width = ((this.element.offsetWidth + SCROLLBAR_WIDTH).toString() + 'px'); - this._viewElement.style.height = ((this.element.offsetHeight + SCROLLBAR_WIDTH).toString() + 'px'); + this._viewElement.style.width = ((this.element.offsetWidth + SCROLLBAR_WIDTH - this.offsetX).toString() + 'px'); + this._viewElement.style.height = ((this.element.offsetHeight + SCROLLBAR_WIDTH - this.offsetY).toString() + 'px'); this._naturalThumbSizeX = this._scrollbarHorizontalElement.clientWidth / this._viewElement.scrollWidth * this._scrollbarHorizontalElement.clientWidth; this._naturalThumbSizeY = this._scrollbarVerticalElement.clientHeight / this._viewElement.scrollHeight * this._scrollbarVerticalElement.clientHeight;