Safari/Chrome (Webkit) - Cannot hide iframe vertical scrollbar

前端 未结 17 767
粉色の甜心
粉色の甜心 2020-11-28 05:32

I have an iframe on www.example.com that points to support.example.com (which is a CNAME to a foreign domain).

I automatically resize the height of my i

相关标签:
17条回答
  • 2020-11-28 06:30

    1.when you change iframe's scrolling yes or no, the iframe's scrollbar dosen't show immediately, you must refresh the iframe.

    2.the html tap overflow in iframe colud influence the iframe's scrollbar

    3.in the IE,you must clear iframe's src,then refresh iframe ,it will be work

    4.so, show you the code

    html

    <iframe id="main_ifrm" class="main"  frameborder="0" scrolling="no" src="new.html" ></iframe>
    <button id="btn1">scrolling yes</button>
    

    javascript

    var ifrm = document.getElementById("main_ifrm");
    var btn1 = document.getElementById("btn1");
    btn1.onclick = function(){
        $(ifrm).prop("scrolling","no");
        $(ifrm.contentWindow.document).find("html").css("overflow","hidden")
        var src = $(ifrm).prop("src");
        $(ifrm).prop("src","");
        $(ifrm).prop("src",src);
    }
    
    0 讨论(0)
  • 2020-11-28 06:33

    I just ran into this problem, and discovered that the fix was to set overflow: hidden on the HTML tag of the page inside the iframe.

    0 讨论(0)
  • 2020-11-28 06:33

    I'm assuming you've tried this, but have you set scrolling to no on the iframe?

    <iframe scrolling="no">
    
    0 讨论(0)
  • do not use scrolling tag at-all on the iframe and add the style as style="overflow-x:hidden;overflow-y:auto;" this will remove the horizontal scroll and it should work the other way round too.

    -Jai

    0 讨论(0)
  • 2020-11-28 06:35

    hide iframe scrolling in chrome put body tag like this

    <body style="margin:0px; padding:0px; overflow:hidden;"></body>
    
    0 讨论(0)
提交回复
热议问题