Skip to content

Commit

Permalink
fix bugs for old browsers that doesn't support width/height or opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
mask8 committed Oct 20, 2011
1 parent f948201 commit 36ffe13
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
// Your code here
$(".scroller").etScroller({
// 'overflow': true,
'hscroll': true,
'vscroll': true
'hscroll': false,
'vscroll': true,
'width': 400,
'height': 400
});
});
</script>
Expand Down
18 changes: 10 additions & 8 deletions js/jquery.et.scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
vscroll: true,
hscroll: false,
hide: false,
overflow: false
overflow: false,
width: null,
height: null
};

return this.each(function(){
Expand All @@ -40,8 +42,8 @@

// change overflow settings of this
$wrapper.css({
'width': $(this).width(),
'height': $(this).height(),
'width': (settings.width) ? settings.width : $(this).width(),
'height': (settings.height) ? settings.height : $(this).height(),
'position': 'relative',
'z-index': 0
});
Expand Down Expand Up @@ -76,7 +78,7 @@
});
if($wrapper.height() >= $content.height() || settings.overflow || !settings.vscroll) {
bar_height = $wrapper.height();
$vbar.css({height: bar_height + "px", opacity: 0.0});
$vbar.css({height: bar_height + "px", 'display': 'none'});
}
$wrapper.append($vbar);

Expand All @@ -100,7 +102,7 @@
});
if($wrapper.width() >= $content.width() || settings.overflow || !settings.hscroll) {
bar_width = $wrapper.width();
$hbar.css({width: bar_width + "px", opacity: 0.0});
$hbar.css({width: bar_width + "px", 'display': 'none'});
}
$wrapper.append($hbar);

Expand Down Expand Up @@ -239,15 +241,15 @@
vmin = -1 * $content.height() + $wrapper.height();
if($wrapper.height() >= $content.height() || settings.overflow || !settings.vscroll) {
bar_height = $wrapper.height();
$vbar.css({'height': bar_height + "px", opacity: 0.0});
$vbar.css({'height': bar_height + "px", 'display': 'none'});
}

bar_width = $wrapper.width() * $wrapper.width() / $content.width();
$hbar.css({ "width": bar_width + "px" });
hmin = -1 * $content.width() + $wrapper.width();
if($wrapper.width() >= $content.width() || settings.overflow || !settings.hscroll) {
bar_width = $wrapper.width();
$hbar.css({'width': bar_width + "px", opacity: 0.0});
$hbar.css({'width': bar_width + "px", 'display': 'none'});
}
});

Expand Down Expand Up @@ -388,4 +390,4 @@
}
};

})( jQuery );
})( jQuery );

0 comments on commit 36ffe13

Please sign in to comment.