diff --git a/antiscroll.css b/antiscroll.css index 2962629..e1ed678 100644 --- a/antiscroll.css +++ b/antiscroll.css @@ -1,5 +1,4 @@ .antiscroll-wrap { - display: inline-block; position: relative; overflow: hidden; } @@ -19,6 +18,7 @@ -webkit-transition: linear 300ms opacity; -moz-transition: linear 300ms opacity; -o-transition: linear 300ms opacity; + z-index: 10; } .antiscroll-scrollbar-shown { @@ -36,9 +36,14 @@ .antiscroll-scrollbar-vertical { width: 7px; margin-top: 2px; - right: 2px; top: 0; } +html[dir='ltr'] .antiscroll-scrollbar-vertical { + right: 2px; +} +html[dir='rtl'] .antiscroll-scrollbar-vertical { + left: 2px; +} .antiscroll-inner { overflow: scroll; diff --git a/antiscroll.js b/antiscroll.js index 2de1812..cd828f0 100644 --- a/antiscroll.js +++ b/antiscroll.js @@ -38,10 +38,13 @@ this.padding = undefined == this.options.padding ? 2 : this.options.padding; this.inner = this.el.find('.antiscroll-inner'); - this.inner.css({ - 'width': '+=' + (this.y ? scrollbarSize() : 0) - , 'height': '+=' + (this.x ? scrollbarSize() : 0) - }); + var css = { + height: '+=' + (this.x ? scrollbarSize() : 0) + }; + if (!this.options.noHScroll) { + css.width = '+=' + (this.y ? scrollbarSize() : 0); + } + this.inner.css(css); this.refresh(); }; @@ -53,7 +56,7 @@ */ Antiscroll.prototype.refresh = function() { - var needHScroll = this.inner.get(0).scrollWidth > this.el.width() + (this.y ? scrollbarSize() : 0), + var needHScroll = this.options.noHScroll ? false : (this.inner.get(0).scrollWidth > this.el.width() + (this.y ? scrollbarSize() : 0)), needVScroll = this.inner.get(0).scrollHeight > this.el.height() + (this.x ? scrollbarSize() : 0); if (this.x) {