From c725214660bc92bc16fbf30f02e37c35aa51a7f5 Mon Sep 17 00:00:00 2001 From: Andrew Naylor Date: Mon, 24 Oct 2011 15:56:11 +0100 Subject: [PATCH 1/2] Fixed: Static Scroll bar height. If you enabled an element for slimScroll then added content to that element scrolling would not work as the scrolling is determined from the height of the scrollbar which was set when initially setting up the pane. This fixes the problem by updating the scrollbar height each time it is shown. --- slimScroll.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/slimScroll.js b/slimScroll.js index 89c09ec..1eae3b1 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,6 +184,10 @@ 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); bar.fadeIn('fast'); } From 1281a3b9c9dd754b2b0c5c899594cbaa42a2fe48 Mon Sep 17 00:00:00 2001 From: Andrew Naylor Date: Mon, 24 Oct 2011 16:03:38 +0100 Subject: [PATCH 2/2] Scrollbar appears when scrolling isn't possible. Do not show scrollbar if the element will not scroll, it's distracting. --- slimScroll.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/slimScroll.js b/slimScroll.js index 1eae3b1..722cf1b 100644 --- a/slimScroll.js +++ b/slimScroll.js @@ -189,6 +189,10 @@ * me.outerHeight(), minBarHeight); bar.css({ height: height + 'px' }); clearTimeout(queueHide); + + if(height >= me.outerHeight()) { + return; + } bar.fadeIn('fast'); }