Full-screen iframe with a height of 100%

前端 未结 17 1494
星月不相逢
星月不相逢 2020-11-22 04:35

Is iframe height=100% supported in all browsers?

I am using doctype as:



        
17条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 05:09

    Here is a concise code. It does relies on a jquery method to find the current window height. On load of iFrame it sets the height of the iframe be the same as the current window. Then to handle resizing of the page, the body tag has an onresize event handler which sets the iframe's height whenever the document is resized.

    
    
        my I frame is as tall as your page
         
    
    
        
    
    
    

    here's a working sample: http://jsbin.com/soqeq/1/

提交回复
热议问题