开发者

Can I use this code to set the height of two elements in jQuery?

开发者 https://www.devze.com 2023-01-13 02:47 出处:网络
I w开发者_开发问答ant to set both #map_canvas and #content\'s height, but this doesn\'t seem to work:

I w开发者_开发问答ant to set both #map_canvas and #content's height, but this doesn't seem to work:

$(['#map_canvas','#content']).css("height", ($(window).height()-270 + "px"));

Does anybody know how to do this?


Try this:

$('#map_canvas, #content').height(window.height-270);

I do something similar with google earth integration on a current project...


Try (you kinda have extra parentesis in there):

$(['#map_canvas','#content']).css("height", $(window).height()-270 + "px");


jQuery("#map_canvas,#content").css("height", (jQuery(window).height() - 270 ) + "px");
0

精彩评论

暂无评论...
验证码 换一张
取 消