I have something like this:
var windowH = $(window).height();
var listH = $(".list").height();
if(windowH > listH){
$(".list").css({'height': windowH+'px'});
alert(windowH);
alert($(".list").css({'height': windowH+'px'}));
}
the second alert gives me [object Object] and therefore doesn’t insert the correct css. can someone help?
Thanks
.cssmethod returns the jQuery object (For method chaining), so the alert result is nothing wrong.Instead of using
.css, try use.heightmethod.