我有两个div,都有0.6不透明度.我需要它们重叠但保持不透明度而不是创建新的组合不透明度级别.我无法使用图像.
编辑 - 小圆圈应该有一个画布元素.不确定伪元素是否是最佳解决方案.
无论如何用CSS做这个,或者我应该只使用画布?
示例 -
http://dabblet.com/gist/1566209
HTML:
<div id="foo">
<div id="bar">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
/**
* Double Opacity
*/
body{background:green;}
#foo{
height:150px;
width:250px;
background:rgba(0, 0, 0, 0.6);
position:absolute;
left:40%;
top:20%;
}
#bar{
height:40px;
width:40px;
background:rgba(0, 0, 0, 0.6);
border-radius:40px;
position:absolute;
top:-15px;
left:-15px;
}
Run Code Online (Sandbox Code Playgroud) 我有一个与onClick事件绑定的函数.它应该播放一首歌.如果有一首歌已经播放,它应该停止当前的歌曲并开始播放新的歌曲.唯一的问题是,据我所知,只有一种暂停方法,这意味着前一首歌将从暂停位置而不是从头开始.有没有办法解决这个问题(比如.stop()方法)?
这是我的代码:
var currSong="";
function playSong(newSong){
alert(newSong);
if (newSong != ""){
if(currSong != "" ) {
document.getElementById(currSong).pause();
}
document.getElementById(newSong).play();
currSong = newSong;
}
}
Run Code Online (Sandbox Code Playgroud)