Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions antiscroll.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.antiscroll-wrap {
display: inline-block;
position: relative;
overflow: hidden;
}
Expand All @@ -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 {
Expand All @@ -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;
Expand Down
13 changes: 8 additions & 5 deletions antiscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand All @@ -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) {
Expand Down