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>

  • 相关阅读:
    php数据库常用函数
    什么是RESTful API
    RESTful API 设计指南
    json和jsonp的使用区别
    Memcached, Redis, MongoDB区别
    入门系列之在Nginx配置Gzip
    100行代码搞定抖音短视频App,终于可以和美女合唱了。
    游戏开发者注意!这个音频SDK可以完美兼容所有主流游戏引擎
    快速上手:在CVM上安装Apache
    聚焦小游戏技术生态,腾讯游戏云GAME-TECH落地厦门
  • 原文地址:https://www.cnblogs.com/songjinduo/p/4633395.html
Copyright © 2011-2022 走看看