2015-09-07 181 views
0

我的iframe上的滾動條不會保持可見狀態。它在iframe首次加載時出現,然後消失。始終顯示iframe垂直滾動條

我曾嘗試:

  • 把SCROLLING = 「是」 在iframe標籤
  • 添加溢出:-moz-滾動條垂直於CSS
  • 將溢出-Y:滾動在CSS

這些都不起作用。

#iframe { 
     overflow: -moz-scrollbars-vertical !important; 
     overflow-y:scroll; 
    } 

<iframe class="iframeclass" id="frame" src="" width="650" height="350" frameBorder="0" scrolling="yes"></iframe> 

我認爲這是一個Mac問題,因爲許多Mac用戶禁用垂直滾動條,因爲他們只是使用觸控板。我嘗試以下(從這個answer):

.iframeclass::-webkit-scrollbar { 
     -webkit-appearance: none; 
    } 

    .iframeclass::-webkit-scrollbar:vertical { 
     width: 11px; 
    } 

    .iframeclass::-webkit-scrollbar:horizontal { 
     height: 11px; 
    } 

    .iframeclass::-webkit-scrollbar-thumb { 
     border-radius: 8px; 
     border: 2px solid white; /* should match background, can't be transparent */ 
     background-color: rgba(0, 0, 0, .5); 
    } 

    .iframeclass::-webkit-scrollbar-track { 
     background-color: #fff; 
     border-radius: 8px; 
    } 

但仍然無法正常工作。

+0

你能提供你的代碼? –

+0

現在檢查答案 –

+0

與-webkit-scrollbar一起工作的css片段對我來說就像一個魅力 – caroso1222

回答

0

檢查:

<div class="scroll-wrapper"> 
<iframe src=""></iframe> 

.scroll-wrapper { 
    -webkit-overflow-scrolling: touch; 
    overflow-y: scroll; 

    /* important: dimensions or positioning here! */ 
} 

.scroll-wrapper iframe { 
    /* nada! */ 
} 

    .demo-iframe-holder { 
    position: fixed; 
    right: 0; 
    bottom: 0; 
    left: 0; 
    top: 0; 
    -webkit-overflow-scrolling: touch; 
    overflow-y: scroll; 
} 

.demo-iframe-holder iframe { 
    height: 100%; 
    width: 100%; 
} 

這支持所有瀏覽器。 檢查文章的更多信息:Article

+0

不,它仍然消失。這是在使用Safari的Mac上。 – Cybernetic