iframe使用总结:

      <!-- 左侧导航   给左侧 设置target="mainiframe ,iframe设置 name="mainiframe" 
点击左侧,右侧自动变化 -->
    <ul>
        <li>
            <dl class="cml_label">
                <dd><label>
                        <a href="/enterpriseportal/user/profile" target="mainiframe"
                            style="color: #000; text-decoration: none">账号管理</a>
                    </label></dd>
            </dl>
        </li>
    </ul>
    <!-- 右侧内容 -->
    <iframe src="/enterpriseportal/basicinfo" name="mainiframe" id="frm"
 width=100% marginheight=0 marginwidth=0
        frameborder="0"></iframe>



    <script>
        // 父页面定义函数
        function sayHello(h) {
            var frm = $(window.parent.document).find("#frm");
            frm.height(1788);
        }
        //子页面调用
        $('.btn-success').click(function () {
            $(window.parent)[0].sayHello(0);
        })


        //每次点击不同的页面跳转,都滑动到开头
        function scrollbegin() {
            $("html,body", window.parent.document).animate({ scrollTop: 0 }, 200);
        }
    </script>

iframe 滚动但不显示滚动条

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        p {

            height: 50px;
            line-height: 50px;
            font-size: 16px;

        }
    </style>
</head>

<body>

    <h1>《断章》--卞之琳</h1>

    <p>你站在桥上看风景</p>

    <p>看风景人在楼上看你</p>

    <p>明月装饰了你的窗子</p>

    <p>你装饰了别人的梦</p>

</body>


</html>
<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>iframe去掉滚动条依然能滚动的方法</title>

<style type="text/css">

*{margin: 0; padding: 0;}

.iframe-wrap{

position: relative;

overflow: hidden;

width: 300px; height: 150px; background: #eee;

}

.iframe{

width: 100%; border: none;

position: absolute; right: -20px; top: 0; bottom: 0;

overflow-x: hidden; overflow-y: scroll;

}

</style>

</head>

<body>

<div class="iframe-wrap">

<iframe src="1.html" class="iframe"></iframe>

</div>

</body>

</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值