Reputation: 94
I have a div with a height that is controlled by jQuery. I have a script that expands the height ("Show More"). Problem is, that the div is set to position: fixed;
, so when you expand it enough that content is outside the window, you cant see it.
What i would like is a jQuery script that makes the div static and not fixed when it expands outside the window.
#left {
width: 250px;
height: auto;
margin-top: 167px;
position: fixed;
float: left;
}
I have no idea how to write this.
Thanks in advance! Have a nice day.
Edit: Almost forgot, i'll post the expand jQuery function if needed, but i didn't think so.
Upvotes: 0
Views: 103
Reputation: 193291
Something like this:
$('#left').css('position', 'static');
or better:
$('#left').toggleClass('expanded');
with CSS:
#left.expanded {position: static;}
Demo: http://jsfiddle.net/WPUzm/
Upvotes: 2