我有一个嵌入在页面中的 youtube iframe,透明 div 正好放在它上面。
我在 div 中有链接,我使用 CSS :hover 使其仅在鼠标悬停在视频上时可见。
是否可以允许用户在不关闭 div 上的悬停效果的情况下单击 div 播放视频?我不能使 div 更小。
我正在寻找类似于pointer-events:none
但保持 div 元素的悬停事件的东西。也许有一个javascript解决方案?
代码演示:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Video test</title>
<style>
#storymenu{position:absolute; width:515px; height:386px;}
#storymenu a{display:none; margin-left:10px; margin-top:20px; padding:5px; background:#FFF;}
#storymenu:hover a{display:inline-block}
</style>
</head>
<body>
<div id="storymenu">
<a href="#" onclick="alert('next');return(false);"><span>Next Story</span> ></a>
<a href="#" onclick="alert('prev');return(false);">< <span>Prev Story</span></a>
</div>
<iframe width="515" height="386" src="http://www.youtube-nocookie.com/embed/5It4y8834Zd" frameborder="0" allowfullscreen></iframe>
</body>
</html>