描述:
JS——实现音量控制拖动
1)、有底条,有拖拽按钮
2)、设置最小和最大值
3)、拖动定位后,抛出事件当前的所在值
效果:
实现:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
#all {
width: 500px;
height: 86px;
margin: 100px auto;
position: relative;
}
#bar {
width: 500px;
height: 20px;
border-radius: 10px;
background: #9acfea;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
cursor: pointer;
}
#box {
width: 30px;