V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Moker
V2EX  ›  问与答

iframe 横向滚动条去不掉

  •  
  •   Moker · 2014-11-08 19:27:26 +08:00 · 2930 次点击
    这是一个创建于 3474 天前的主题,其中的信息可能已经有所发展或是发生改变。
    已经用OVERFLOW-X:hidden这种方式了,发现在iframe固定宽高(小于包含页的宽高)的时候根本不生效
    代码见:
    http://someant.com/meet/
    后来改为大圈套小圈的方式
    这样做好像iframe的包含页显示的是大圈的宽高了
    http://someant.com/meet/index2.html
    这样做就不能定义宽高为700*970px

    搞不懂为什么会有这的需求,而且还要小于包含页
    有什么方法可以去掉滚动条么?
    6 条回复    2014-11-09 00:08:46 +08:00
    dong3580
        1
    dong3580  
       2014-11-08 19:43:01 +08:00
    正巧前端时间被这玩意折磨的,
    这样呢?

    <iframe id="id1" width="100%" height="100%" frameborder="0" scrolling="NO">
    </iframe>
    Moker
        2
    Moker  
    OP
       2014-11-08 19:46:10 +08:00
    @dong3580 这样设置的话 就不是固定宽度了吧~~~
    dong3580
        3
    dong3580  
       2014-11-08 19:54:58 +08:00   ❤️ 1
    给你写个高度出现这种情况的办法,宽度以此类推:

    被嵌套页面加上
    $('#id1', window.parent.document).css("height",window.screen.height-80);
    适当时候被嵌套页面加入触发:
    function WindowNewHeight(){
    var height=$("#div1").height()+220;//div1为被嵌套页面的一个div1
    $("#id1",window.parent.document).height(height);//id1为iframe id
    }

    每个事件加入判断
    Moker
        4
    Moker  
    OP
       2014-11-08 22:24:31 +08:00
    @dong3580 明天去试下
    kmvan
        5
    kmvan  
       2014-11-08 22:34:35 +08:00
    FF 没看到横向滚动条
    Moker
        6
    Moker  
    OP
       2014-11-09 00:08:46 +08:00
    @kmvan 我测试过 有滚动条的。。你是14寸的显示屏么。。如果是的话你缩小看就有了,那是因为高度问题把滚动条给顶出画面外了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3890 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 04:34 · PVG 12:34 · LAX 21:34 · JFK 00:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.