Reputation: 407
I'm trying to get Div1's height set to auto. Then, I want Div2 to be 50 pixels longer than Div1 at all times.
Here's the code I currently have:
if(h > 600 ) {
$('#Div1').css('height','auto');
$('#Div2').height( $('#Div1').height() + 50 );
}
This works perfectly fine without the "+ 50" part. With the "+ 50", the page will run, but the code has no effect.
What could be going wrong?
Upvotes: 1
Views: 58
Reputation: 144
try this
if(h > 600 ) {
$('#Div1').css('height','auto');
$('#Div2').height( parseInt($('#Div1').height() + 50) );
}
use
ParseInt ($('#Div1').height() + 50)
because JavaScript default plus work as 1+1 = 11
i hope this will work Please reply me if this will work
Upvotes: 2