Reputation: 9
first my code!
$(document).ready(function () {
$(".wrap2").click(function(){
var n = $(".wrap2").height;
if (n > 180) {
$(".wrap2").css("height","170px");
$(".wrap3").animate({top:'340px'}, 500);
$(".wrap4").animate({top:'510px'}, 500);
$(".wrap5").animate({top:'680px'}, 500);
}
else {
$(".wrap2").css("height","400px");
$(".wrap3").animate({top:'570px'}, 500);
$(".wrap4").animate({top:'740px'}, 500);
$(".wrap5").animate({top:'910px'}, 500);
}
});
});
I want the div ".wrap2" to increase its height on click, but to check if the divs height is over 180! if it is decrease its height to what ive set up! the code is prob selfexplanatory! I just dot seem to find whats wrong with it! the other divs are just setup to animate accordingly to the in/decrease!
Upvotes: 0
Views: 46
Reputation: 15112
var n = $(".wrap2").height();
^
Add the parentheses. Without the parentheses .height
, will result in the underlying function to get the height.
Upvotes: 2