How catch iframe resize event from inside the iframe (iframe and the page - same domain)

后端 未结 3 1182
温柔的废话
温柔的废话 2021-01-18 07:31

I try to listen from inside of iframe to changes of iframe width/height with:

$(window).resize(function(){
    alert(\'1 on inside iframe\');
});


        
相关标签:
3条回答
  • 2021-01-18 08:25
    $(body).resize(function(){
        alert('on inside iframe');
    });
    

    Edit :

    in html

    <body onresize="myFunction()">
    
    0 讨论(0)
  • 2021-01-18 08:26

    You need to call the resize() handler from the parent document on the iframe:

    $('iframe').resize(function() {} );
    
    0 讨论(0)
  • 2021-01-18 08:35

    Try that : http://www.iframehtml.com/iframe-scripts.html#resizeable-iframe

    Or that : http://css-tricks.com/snippets/jquery/fit-iframe-to-content/

    0 讨论(0)
提交回复
热议问题