将鼠标悬停在jsfiddle中的音量图标上,您可以看到它向左移动静音。
如何保持图标就位,只是将音量栏向右扩展?
我知道我可以更改进度条上的最小宽度,但我不想这样做。
除了音量控制和儿童
之外,我最好不要更改任何其他div的cssHTML:
<div class="jp-sleek jp-jplayer jp-audio">
<div class="jp-gui">
<div class="jp-controls jp-icon-controls">
<button class="jp-repeat"><i class="fa fa-repeat"></i></button>
<div class="jp-progress">
</div>
<div class="jp-volume-controls">
<button class="jp-mute"><i class="fa fa-volume-off"></i></button>
<div class="jp-volume-bar">
</div>
</div>
<button class="jp-full-screen"><i class="fa fa-expand"></i></button>
</div>
</div>
</div>
相关的css:
.jp-volume-bar {
height: 6px;
width: 0;
background-color: #a1c1f4;
cursor: pointer;
border-radius: 1px;
transition-duration: 0.3s;
}
.jp-volume-controls:hover .jp-volume-bar {
width: 100px;
transition-duration: 0.3s;
}
答案 0 :(得分:1)
您可以设置.jp-progress { flex: 0 0 240px; }
而不是width
。
.jp-jplayer {
min-width: 900px;
}
.jp-jplayer .fa {
font-size: 24px;
}
.jp-sleek .jp-gui {
height: 42px;
background-color: #e5e5e5;
position: relative;
}
.jp-sleek .jp-gui .jp-icon-controls .jp-progress {
background-color: green;
height: 100%;
flex: 0 0 240px;
/* width: 600px; */
/* min-width:240px; */
position: relative;
}
.jp-sleek .jp-gui .jp-controls {
height: 100%;
position: relative;
margin: 0 auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 50%;
}
.jp-sleek .jp-gui .jp-controls .jp-volume-controls {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.jp-sleek .jp-gui .jp-icon-controls button {
min-width: 42px;
}
.jp-sleek .jp-gui .jp-controls button {
color: #000;
padding: 0;
border: none;
background-color: transparent;
}
.jp-sleek .jp-gui .jp-mute {
height: 100%;
}
.jp-volume-bar {
height: 6px;
width: 0;
background-color: #a1c1f4;
cursor: pointer;
border-radius: 1px;
transition-duration: 0.3s;
}
.jp-volume-controls:hover .jp-volume-bar {
width: 100px;
transition-duration: 0.3s;
}
&#13;
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="jp-sleek jp-jplayer jp-audio">
<div class="jp-gui">
<div class="jp-controls jp-icon-controls">
<button class="jp-repeat"><i class="fa fa-repeat"></i></button>
<div class="jp-progress">
</div>
<div class="jp-volume-controls">
<button class="jp-mute"><i class="fa fa-volume-off"></i></button>
<div class="jp-volume-bar">
</div>
</div>
<button class="jp-full-screen"><i class="fa fa-expand"></i></button>
</div>
</div>
</div>
&#13;