zoukankan      html  css  js  c++  java
  • 去除带有iframe页面中的2个滚动条[转]

    方法一:加载frame时修改高度

      <div>
        <iframe id="frame_content" name="frame_content" src="<%=path%>/configuration.jsp" width="100%" height="95%"
                    frameborder="0" marginwidth="0" marginheight="0" scrolling="auto"
                    onload="this.height=this.contentWindow.document.documentElement.scrollHeight"></iframe>
      </div>

    方法二:

    用iframe的人都知道,(大神请飘过……)右边的iframe总是带着滚动条,而页面上默认也有滚动条,一个页面2个滚动条当然不好啦,去除的话……下面是个简单的jquery,这是kaka给写的,好用好理解,灰常感谢……

    结构:

    <body>

        <div class="warp_body">

            <div class="warp_header"></div>

            <div class="warp_content">

                <div class="sidebar"></div>

                <div class="content">

                    <div class="content-item">

    <iframe width="100%" style="height:668px" frameborder="0" src="http://thehlc.cn"></iframe>

                     </div>

                </div>

            </div>

        </div>

    <script type="text/javascript">adjustIfrHt();</script>//加到页面最后

    </bocy>

    jQuery部分:

    <script type="text/javascript">

      function adjustIfHt(){

        var ht = $(window).height();//获取浏览器窗口的整体高度;

        var topHeader = $(".warp_header").height();//获取头部高度,定义一个变量名为topHeader

        $(".sidebar").height(ht);

        $("#rightFrame").height(ht);

        $(".sidebar").height(ht-topHeader);//计算左边高度:窗口高度-头部高度

        $("#rightFrame").height(ht-topHeader);//计算右边高度:窗口高度-头部高度

      }

    </script>

    样式部分:

    <style type="text/css">

        html{overflow:hidden;}//隐藏整个页面的滚动条;

    </style>

  • 相关阅读:
    【Demo 0062】文件遍历
    【Demo 0068】获取分区信息
    【Demo 0060】记录个人信息
    【Demo 0069】文件读写
    【Demo 0064】监控文件/目录变更
    【Demo 0067】文件类型关联图标
    【Demo 0065】获取被修改的文件/目录
    【Demo 0062】目录及文件基本操作
    【Demo 0061】打开与保存文件
    【Demo 0066】监控被变更文件/目录(完成端口)
  • 原文地址:https://www.cnblogs.com/songjinduo/p/4633395.html
Copyright © 2011-2022 走看看