-
Notifications
You must be signed in to change notification settings - Fork 931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
max-height option #70
Comments
+1 |
+1, nice feature - facing same problem now. |
+1, same here. please help.. thanks! |
found the solution guys! find the; hope it will help |
Well I had to comment each line where "height" was mentioned, including the whole block that begins with: |
Nice and simple solution guys. Well done! |
@cbruguera thanks for a tip! works for me now perfectly |
👍 |
+1 Yes Please! |
@cbruguera thanks for your post, it saved me a heap of time the other day! FYI if you'd rather not comment lines out, I poked around the source and had some luck doing the following:
i.e. $(function(){
$('#your-content-div-with-max-height').slimScroll({
height: ''
});
}); This works because the plugin uses jQuery to set the height to whatever value you provide (via .css()), so a blank value will actually remove (or in this case not set) that css property. This leaves one problem however, the scroll-rail goes ballistic (for me at least). To address this, I changed one line in the following from: // create scrollbar rail
var rail = $(divS)
.addClass(o.railClass)
.css({
width: o.size,
height: '100%',
position: 'absolute',
top: 0,
display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none',
'border-radius': o.railBorderRadius,
background: o.railColor,
opacity: o.railOpacity,
zIndex: 90
}); To: // create scrollbar rail
var rail = $(divS)
.addClass(o.railClass)
.css({
width: o.size,
height: o.height ? '100%' : '', // This worked for me
position: 'absolute',
top: 0,
display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none',
'border-radius': o.railBorderRadius,
background: o.railColor,
opacity: o.railOpacity,
zIndex: 90
}); If this works for other people (:question:) I'll submit a pull request :shipit:. |
I tried both the methods @cbruguera & @phippsnatch and neither worked. I have repeating fields in my form and i just need the scrollbar to appear when the height changes. Thanks in advance for your help! |
+1! |
I tried what @phippsnatch suggested and it works perfectly so far. I am not using the rails, so I haven't even patched the plugin. |
@phippsnatch approach worked, but when the content area is smaller than the From
To
|
Hi All, I did something what works in my case: update defaults with maxHeight property:
line 113:
Created maxHeight condition:
Add condition on optionally set parent height
Height and max height on element add like in code below:
Then call plugin like this:
In this case maxHeight and Height works fine. But I'm not sure is it something broken. What I saw from my example everything works fine. |
this is what worked for me: I'm refereing my content Div by class, you may use Div Id. Hope it works for u too :) |
you can use slimscroll="{height:''}" and give your own max-height like this style="max-height:150px;" or you can use youe own class |
Since I didn't want to change the javascript file itself, I ended up by creating an external javascript function which reinitiates the slimmscroll function, based on a max height value and the current height of the 'scrollable' area. You need to call this function everytime the contents of the scrollable area are changing:
You call the function like this: |
Global CSS, can be controlled by class for each height settings
|
It would be nice if, apart from the
height
option we could use another one to specify themax-height
, which means that the scroll bar will only start working if the content height is superior to that value but otherwise it wouldn't.Right now if the
height
option is specified, the container will always be of that fixed height. In some cases that's not desirable. For example, a list of comments in which we want to scroll them if the height is more than 500px but in the case there are only one or two comments, we don't want to waste 500px of height. Just the needed space for the current content without scrolling.As far as I know that's not possible right now but would be a nice feature to add.
The text was updated successfully, but these errors were encountered: