开发者

can't get height of object in chrome

开发者 https://www.devze.com 2022-12-24 19:22 出处:网络
i want to get the height property of a object: $(\'.selector img\').each(function(index,e){ thisImage = $(\'#topContent img\').get(index);

i want to get the height property of a object:

$('.selector img').each(function(index,e){   
    thisImage = $('#topContent img').get(index);
}

so long no problem, but then i want to get the height like this:

thisImage.height;

i thought it was equvivilent to:

thisImage.height();

or:

thisImage.css("height");
开发者_运维百科

but neither does work for me.

And the greatest problem is that

thisImage.height;

Dose not work in chrome.

Have i missed something or is this a known bug? is there another way to get the height in chrome?


Specifically the object returned by get() is going to be the actual DOMElement not the jQuery object so you need to wrap it in jq. like $(thisImage).height() or use the actual selector as Catfish suggests.


try

var thisImage = $('#topContent img').height();
0

精彩评论

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

关注公众号