Get height of element inside iframe with jQuery

前端 未结 1 2011
失恋的感觉
失恋的感觉 2020-12-17 03:12

I have a file containing an \"iframe\" element


and a file t

相关标签:
1条回答
  • 2020-12-17 03:49

    Assuming the iframe is on the same domain (otherwise it's not possible), you should wait for the iframe to load first :

    $(document).ready(function() {
        $( "#frameDemo" ).on('load', function() { 
            var mydiv = $(this).contents().find("div");
            var h     = mydiv.height();
            alert(h);
        });
    });
    
    0 讨论(0)
提交回复
热议问题