jQuery解决iframe高度自适应代码

  作者:bea

代码如下: <script type="text/javascript"> <!-- $( function() { //iframe高度随内容自动调整 $('.main').load( function() { $(this).height($(this).contents().find("body").attr('scrollHeight')); } ); } ); // --> </script>

代码如下:


<script type="text/javascript">
<!--
$(
    function()
    {                    
     //iframe高度随内容自动调整
        $('.main').load(
         function()
            {
                $(this).height($(this).contents().find("body").attr('scrollHeight'));
            }
        );
    }
);     
// -->
</script>




有用  |  无用

猜你喜欢