[英]HTML iframe with different domain src: how to disable the click but keep the hover intact
我有這個iframe,其來源是其他一些域。 由於iframe包含一些我不想工作的鏈接。 我正在嘗試禁用點擊,但需要將鼠標懸停在iframe上。
<iframe id='myframe' style='width: 1000px; height: 700px;' src='http://www.voyant-tools.org/tool/Cirrus/?visible=335&corpus=9ecfdf31007fbd721c5b414ea9294b5c'></iframe>
我試過使用CSS:
#myframe{
pointer-events:none;
}
但這也會禁用懸停。 如何禁用點擊但保持懸停不變?
您可以通過在現有iframe上添加透明層來實現所需的效果。
您必須在iframe中聲明另一個<div>
,然后向其中添加以下樣式屬性
.overlay {
background-color: rgba(1, 1, 1, 0.0);
bottom: 0;
left: 0;
position: fixed;
right: 0;
top: 0;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.