From b613f22a0383c65060a0798f65845b6f72a11ea3 Mon Sep 17 00:00:00 2001 From: Christian Mikalsen Date: Tue, 28 Feb 2012 15:47:44 +0100 Subject: [PATCH] Support for automatically setting the height of the scroll area to the height of the parent element(s). --- slimScroll.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/slimScroll.js b/slimScroll.js index 601a0aa..33699cb 100644 --- a/slimScroll.js +++ b/slimScroll.js @@ -30,12 +30,15 @@ allowPageScroll: false, scroll: 0 }; - + var o = ops = $.extend( defaults , options ); - + + // used in event handlers and for better minification + var me = $(this); + // do it for every element that matches selector this.each(function(){ - + var isOverPanel, isOverBar, isDragg, queueHide, barHeight, percentScroll, divS = '
', minBarHeight = 30, @@ -55,10 +58,12 @@ railOpacity = o.railOpacity, allowPageScroll = o.allowPageScroll, scroll = o.scroll; - - // used in event handlers and for better minification - var me = $(this); - + + // optionally set height to the parent's height + if (cheight == 'auto') { + cheight = me.parent().innerHeight(); + } + //ensure we are not binding it again if (me.parent().hasClass('slimScrollDiv')) {