我正在尝试做一个真正最小的播放器——只有一个播放按钮,另一个按钮可以放大到一个全尺寸的播放器。(小提琴。)
据我所知,没有办法摆脱按钮后面的白色背景。(在实际情况下,背景是带纹理的图像,因此仅将 iframe 的 bg 颜色更改为其他纯色将不如拥有透明(无边框)小部件理想。
小提琴代码:
HTML
<div id="player-controls"><a href="#zoom" onclick="$('#player-container').toggleClass('enlarged'); return false"><span>zoom player</span></a></div>
<div id="player-container">
<iframe width="450" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F3036975"></iframe>
</div>
CSS
body {
position: relative;
background: black;
margin: 10px
}
#player-container {
position: absolute;
top: 1.5em;
height: 36px;
width: 36px;
overflow: hidden;
transition: width, height;
transition-duration: .5s;
-webkit-transition: width, height;
-webkit-transition-duration: .5s;
-moz-transition: width, height;
-moz-transition-duration: .5s;
-o-transition: width, height;
-o-transition-duration: .5s;
}
#player-container.enlarged {
width: 450px;
height: 450px;
}
#player-container iframe {
position:absolute;
top: -11px;
left: -177px;
transition: top, left;
transition-duration: .5s;
-webkit-transition: top, left;
-webkit-transition-duration: .5s;
-moz-transition: top, left;
-moz-transition-duration: .5s;
-o-transition: top, left;
-o-transition-duration: .5s;
}
#player-controls {
position: absolute;
top: 0;
}
#player-controls a {
color: white;
}
#player-container.enlarged iframe {
top: 0;
left: 0;
}