From deca867ec6544d864db36b7441772a12ec22aec8 Mon Sep 17 00:00:00 2001 From: elad Date: Sat, 6 Sep 2014 00:12:00 +0300 Subject: [PATCH 1/4] Add a "noHScroll" option to prevent horizontal scrollbar. --- antiscroll.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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) { From 234de1be7fad98a4ddce30755450fccfa9f1dcb0 Mon Sep 17 00:00:00 2001 From: elad Date: Thu, 11 Sep 2014 22:12:40 +0300 Subject: [PATCH 2/4] Give the scrollbar a reasonable z-index and add RTL support. This makes the scrollbar visible above Bootstrap 3 inputs. --- antiscroll.css | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/antiscroll.css b/antiscroll.css index 2962629..028e7b6 100644 --- a/antiscroll.css +++ b/antiscroll.css @@ -19,6 +19,7 @@ -webkit-transition: linear 300ms opacity; -moz-transition: linear 300ms opacity; -o-transition: linear 300ms opacity; + z-index: 1000; } .antiscroll-scrollbar-shown { @@ -36,9 +37,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; From 68ab090f70c2c9887d7eaf45ead83df74047e5f2 Mon Sep 17 00:00:00 2001 From: elad Date: Wed, 17 Sep 2014 18:13:32 +0300 Subject: [PATCH 3/4] Saner z-index for the vscroll. --- antiscroll.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/antiscroll.css b/antiscroll.css index 028e7b6..ff16226 100644 --- a/antiscroll.css +++ b/antiscroll.css @@ -19,7 +19,7 @@ -webkit-transition: linear 300ms opacity; -moz-transition: linear 300ms opacity; -o-transition: linear 300ms opacity; - z-index: 1000; + z-index: 10; } .antiscroll-scrollbar-shown { From 9ca9143a5405491106f47078fa6bda600eb8a1cc Mon Sep 17 00:00:00 2001 From: elad Date: Tue, 7 Oct 2014 20:05:03 +0300 Subject: [PATCH 4/4] Remove "display: inline-block;" because it adds extra space. --- antiscroll.css | 1 - 1 file changed, 1 deletion(-) diff --git a/antiscroll.css b/antiscroll.css index ff16226..e1ed678 100644 --- a/antiscroll.css +++ b/antiscroll.css @@ -1,5 +1,4 @@ .antiscroll-wrap { - display: inline-block; position: relative; overflow: hidden; }