开发者

jQuery outerHeight is not working when reattaching an element

开发者 https://www.devze.com 2023-04-01 05:02 出处:网络
I create div containing an image and attach it to an iframe.To determine the height iframe with the div, I use the jQuery.outerHeight on the div by atta开发者_JS百科ching it the body. The first time I

I create div containing an image and attach it to an iframe.To determine the height iframe with the div, I use the jQuery.outerHeight on the div by atta开发者_JS百科ching it the body. The first time I do it, it returns the correct value. But when I remove this div from iframe and try to reattach it the another iframe again, jQuery.outerHeight doesn't work again. It doesn't calculate the padding of the div.


I understand, it is because JavaScript handles the frame to a full load of all elements of the frame. I placed an event:

$(window).load(function() {
    //here is cod
});


Wild guess: jQuery can't measure something if it is not visible. Are you sure the element is visible when you reattach it?

0

精彩评论

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