【www.gdgbn.com--jquery】

iframe框架高度自适应功能在以前我们都是利用js来实现,现在有了jquery控制可以快速实现,下面来看实现有需要的朋友可以看看。



 
   
    jquery » iframe sizing
    css教程" media="all" href="css/master.css" />
    <script type="text/网页特效" src="js/jquery-1.4.3.min.js"></script>
    <script type="text/javascript" src="js/jquery.iframe-auto-height.plugin.js"></script>
 
 
   
       


            jquery » iframe sizing
       


       


            this demo uses jquery to dynamically size iframes based on content height.
            original code by nathan smith, see original article.
       


       


            now a jquery plugin, download from github http://github.com/house9/jquery-iframe-auto-height
            and view the readme file.
       


       


          best viewed locally with firefox.
           | 
          index2
           | 
          index_with_tables         
       

       

       
       
       
       

         

       
       
       
       

         
   
   
       
    <script type="text/javascript">
      // match all iframes / use jquery or alias $
      jquery("iframe").iframeautoheight();
 
      // only panoramic.html iframe with some extra height
      // $("iframe.photo").iframeautoheight({heightoffset: 50});
 
      // notes: you can wrap this in document ready if you like
      // but ie8 didn"t always like it
    </script>
    
   
 

这样做起比较js要方便了许多,并且我们只要利用 jquery("iframe").iframeautoheight();来自适应高度就可以了。

本文来源:http://www.gdgbn.com/wangyezhizuo/29109/