Control iframe height with jQuery

后端 未结 9 1720
情书的邮戳
情书的邮戳 2020-12-13 07:32

I am using jQuery to control the height of an iframe.

jQuery(\"iframe\",top.document).contents().height();  

This works when the height of

9条回答
  •  自闭症患者
    2020-12-13 07:48

    I have successfully resize iframe's height and width when it is loaded. basically you can do this as below, and I also post a small article on my blog: http://www.the-di-lab.com/?p=280

    
    $(".colorbox").colorbox(
    
    {iframe:true,
    
    innerWidth:0,
    
    innerHeight:0,
    
    scrolling:false,
    
    onComplete:function(){
    
    $.colorbox.resize(
    
    {
    
    innerHeight:($('iframe').offset().top + $('iframe').height()),
    
    innerWidth:($('iframe').offset().left + $('iframe').width())
    
    }
    
    );
    
    }
    
    }
    
    );
    
    

提交回复
热议问题