2014-05-07 32 views
2

我有一個看起來像這樣的iframe:IFRAME禁用滾動選項卡上的

<!DOCTYPE html> 
<html> 
<body> 

<iframe src="http://www.w3schools.com" style = 'height:100px;width:200px;' scrolling = 'no'> 
    <p>Your browser does not support iframes.</p> 
</iframe> 

</body> 
</html> 

所以當我按在iframe標籤,橫向穿過的所有鏈接,automaticall滾動一路的底部位於iframe中的網站。我想要做的是製作iframe,使其只能在高度= 100px,寬度= 200px的矩形框內忽略,並忽略網站上的所有其他內容......基本上剪切了不適合此矩形的其他所有內容......

我試着設置高度和寬度,也溢出:隱藏,但這似乎並沒有伎倆。

+0

您的代碼適用於Chrome和IE10。 –

+0

不,但它會標記w3schools網站上的所有內容。我想要的是它只能通過200px X 100px窗口中顯示的內容進行選擇。 w3schools網站上任何不屬於此窗口的鏈接都不應該集中在tab鍵上。 – Ashesh

+0

請提供一個JSFiddle示例,這個http://jsfiddle.net/7ky5y/似乎工作 –

回答

0

從能夠點擊任何地方在iframe中,但由於某種原因,這將阻止用戶,您還可以點擊內部和標籤通過:-(fiddle

<div id="IframeWrapper" style="position: relative;"> 
    <div id="iframeBlocker" style="position: absolute; top: 0; left: 0; width: 400px; height: 200px"></div> 
    <iframe src="http://www.w3schools.com" style='height:200px;width:400px;' scrolling='no'> 
     <p>Your browser does not support iframes.</p> 
    </iframe> 
</div> 
+0

也嘗試設置'tab-index:-1'到iframe和一個包裝div無濟於事 –