Reputation: 10849
I'm not so great with the whole "Javascript" thing, but here's what I'm trying to do. Thanks to a table layout I can't use height:100%;
for div's within it (damn you Firefox!). So my new solution is to grab the height of the table cell that my scrollable div sits in and get that value using jQuery's "innerheight" function. I know how to use the function to get the height, but I don't know how to make that value the height of the scrollable div.
StackOverflow community, you are my only hope!
I was thinking of using Javascript to add a class to my div with the new height in that class, but then I realized I don't know how to get my innerheight()
value in a class. Is there maybe someway javascript can grab the div and add a style=""
inside of it?
I'm having trouble wrapping my head around this.
Upvotes: 0
Views: 1642
Reputation: 2726
$(function(){
var innerHeight = $('#cell').innerHeight();
$('#scrollable').height(innerHeight);
});`
Example: http://jsfiddle.net/annF4/
Upvotes: 0
Reputation: 9382
If you have the height and you want to change a div , just do the following
$("#myDiv").css("height", myHeight+"px");
Where "myDiv" is the "id" of the needed div.
Shai.
Upvotes: 3