diff --git a/slimScroll.js b/slimScroll.js index 89c09ec..722cf1b 100644 --- a/slimScroll.js +++ b/slimScroll.js @@ -74,11 +74,6 @@ rail.css(posCss); bar.css(posCss); - //calculate scrollbar height and make sure it is not too small - var height = Math.max((me.outerHeight() / me[0].scrollHeight) - * me.outerHeight(), minBarHeight); - bar.css({ height: height + 'px' }); - //wrap it me.wrap(wrapper); @@ -189,7 +184,15 @@ var showBar = function() { + //calculate scrollbar height and make sure it is not too small + var height = Math.max((me.outerHeight() / me[0].scrollHeight) + * me.outerHeight(), minBarHeight); + bar.css({ height: height + 'px' }); clearTimeout(queueHide); + + if(height >= me.outerHeight()) { + return; + } bar.fadeIn('fast'); }