jquery+css布局实现可拖拽调节的调音器面板代码

代码语言:html

所属分类:布局界面

代码描述:jquery+css布局实现可拖拽调节的调音器面板代码,可拖拽调节旋钮。

代码标签: jquery css 布局 拖拽 调节 调音器 面板 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  
  
<style>
html, body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

body {
  background: #270036;
  background: linear-gradient(to bottom, #12214c, #697979, #891962);
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  width: 800px;
}

select {
  transform: translateY(-50px);
  padding: 10px 16px;
  border-radius: 20px;
  -webkit-appearance: none;
  -moz-appearance: none;
  text-indent: 1px;
  text-overflow: "";
}

#face {
  transform: rotate(90deg) scale(1.4);
  transform-origin: center center;
  padding: 6px;
  border-radius: 10px;
  background: white;
  box-shadow: 0 0 20px #0000004d;
}

#pedal {
  position: relative;
}

.knob, .footswitch, .led {
  position: absolute;
  z-index: 999;
  display: block;
}

.knob {
  width: 80px;
  height: 80px;
  background: black;
  border-radius: 50%;
  transform: rotate(90deg);
  transition: transform 0.5s ease-in-out;
  overflow: hidden;
}
.knob.active {
  transition: none;
}
.knob#gainA, .knob#toneA, .knob#gainB, .knob#toneB {
  top: 30px;
}
.knob#volA, .knob#volB {
  top: 130px;
}
.knob#gainA {
  left: 220px;
}
.knob#toneA {
  left: 390px;
}
.knob#volA {
  left: 305px;
}
.knob#gainB {
  left: -115px;
}
.knob#toneB {
  left: 55px;
}
.knob#volB {
  left: -30px;
}
.knob:before {
  content: "";
  display: block;
  position: absolute;
  top: calc(50% - 23px);
  width: 100%;
  height: 46px;
  box-shadow: 0 0 30px #888;
}
.knob:after {
  content: "";
  display: block;
  position: absolute;
  top: calc(50% - 2px);
  width: 30px;
  height: 4px;
  background: white;
}

#toggle {
  position: absolute;
  z-index: 999;
  top: 170px;
  left: 164px;
}
#toggle:before {
  content: "";
  display: block;
  height: 24px;
  background: radial-gradient(#333, #fafafa);
  transform: rotate(30deg) translateX(-2px);
  aspect-ratio: 1/cos(30deg);
  clip-path: polygon(50% -50%, 100% 50%, 50% 150%, 0 50%);
}
#toggle:after {
  content: "";
  display: block;
  position: absolute;
  box-sizing: border-box;
  bottom: 7px;
  left: 6px;
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/ZtYdiuj26UdAdQQSXQErwSOMzt/XWRWAz5GuSBIkwG1H3FabJ2OsUOUhGC6tK4EMtJO0ttC6IBD3kM0ve0tJwMdSfjZo+EEISaeTr9P3wYrGjXqyC1krcKdhMpxEnt5JetoulscpyzhXN5FRpuPHvbeQaKxFAEB6EN+cYN6xD7RYGpXpNndMmZgM5Dcs3YSNFDHUo2LGfZuukSWyUYirJAdYbF3MfqEKmjM+I2EfhA94iG3L7uKrR+GdWD73ydlIB+6hgref1QTlmgmbM3/LeX5GI1Ux1RWpgxpLuZ2+I+IjzZ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uV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
  background-color: #ddd;
  width: 12px;
  height: 50px;
  border-radius: 8px;
  box-shadow: inset -4px 0px 6px #999;
  transform-origin: center 44px;
  transform: rotate(25deg);
  transition: transform 0.2s ease-in;
}
#toggle.reversed:after {
  transform: rotate(-25deg);
}

.footswitch {
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/ZtYdiuj26UdAdQQSXQErwSOMzt/XWRWAz5GuSBIkwG1H3FabJ2OsUOUhGC6tK4EMtJO0ttC6IBD3kM0ve0tJwMdSfjZo+EEISaeTr9P3wYrGjXqyC1krcKdhMpxEnt5JetoulscpyzhXN5FRpuPHvbeQaKxFAEB6EN+cYN6xD7RYGpXpNndMmZgM5Dcs3YSNFDHUo2LGfZuukSWy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OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
  background-color: #fafafa;
  border-radius: 50%;
  padding: 8px;
}
.footswitch:before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 6px;
  left: 2px;
  display: block;
  height: 55px;
  background: #eee;
  transform: rotate(30deg) translateX(-2px);
  aspect-ratio: 1/cos(30deg);
  clip-path: polygon(50% -50%, 100% 50%, 50% 150%, 0 50%);
}
.footswitch:after {
  content: "";
  display: block;
  position: relative;
  z-index: 2;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/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j/OGbIs8TahLyynl4X4RinF793Oz+BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
  background-color: #ddd;
}
.footswitch#fsA, .footswitch#fsB {
  top: 366px;
}
.footswitch#fsA {
  left: 356px;
}
.footswitch#fsB {
  left: -69px;
}

.led {
  background: #dfdfdf;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  border: 2px solid #cecece;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  transition: all 0.1s ease-in-out;
  box-sizing: border-box;
}
.led.active {
  background: #6dd3ff;
  background: radial-gradient(#baeaff, #6dd3ff);
  box-shadow: 0 0 20px 6px #6dd3ff;
  border: 2px solid #75b7ff;
}
.led#ledA, .led#ledB {
  top: 390px;
}
.led#ledA {
  left: 305px;
}
.led#ledB {
  left: 30px;
}
</style>

  
</head>

<body translate="no">
  <div class="container">
  <select>
    <option disabled selected>Settings</option>
    <option value="2,10,8,0,0,0,0,1,0">Boost</option>
    <option value="3,9,7,0,0,0,0,1,0">Soft overdrive</option>
    <option value="5,9,5,0,0,0,0,1,0">Medium overdrive</option>
    <option value="8,8,4,0,0,0,0,1,0">Hard overdrive</option>
    <option value="8,8,4,3,9,7,0,1,1">Hard > Soft overdrive</option>
    <option value="8,8,4,3,9,7,1,1,1">Soft > Hard overdrive</option>
    <option value="9,9,1,3,9,7,0,1,1">Underdrive</option>
  </select>

<div id="pedal">
  <div id="gainA" class="knob" data-setting="0"></div>
  <div id="toneA" class="knob" data-setting="1"></div>
  <div id="volA" class="knob" data-setting="2"></div>

  <div id="gainB" class="knob" data-setting="3"></div>
  <div id="toneB" class="knob" data-setting="4"></div>
  <div id="volB" class="knob" data-setting="5"></div>
  
  <a href="#" id="toggle" data-setting="6"></a>
  
  <a href="#" id="fsA" data-led="ledA" class="footswitch"></a>
  <a href="#" id="fsB" data-led="ledB" class="footswitch"></a>
  
  <div id="ledA" class="led" data-setting="7"></div>
  <div id="ledB" class="led" data-setting="8"></div>
  
  <svg
   version="1.1"
   id="face"
   width="340.15732"
   height="436.53601"
   viewBox="0 0 340.15732 436.53601"
   sodipodi:docname="Double_BB_PE_prod.svg"
   xml:space="preserve"
   inkscape:version="1.3.2 (091e20e, 2023-11-25)"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg"><defs
     id="defs1"><rect
       x="-235.99287"
       y="110.30102"
       width="166.73409"
       height="86.573468"
       id="rect23" /><rect
       x="183.14441"
       y="410.57374"
       width="24.505575"
       height="14.310555"
       id="rect22" /><rect
       x="22.53167"
       y="206.60921"
       width="44.649915"
       height="28.422978"
       id="rect15" /><rect
       x="183.14441"
       y="410.57373"
       width="34.704288"
       height="20.953136"
       id="rect22-7" /><rect
       x="183.14441"
       y="410.57373"
       width="34.704288"
       height="20.953136"
       id="rect22-1" /><rect
       x="183.14441"
       y="410.57373"
       width="34.704288"
       height="20.953136"
       id="rect22-1-8" /><rect
       x="183.14441"
       y="410.57373"
       width="32.979732"
       height="14.547639"
       id="rect22-2" /><rect
       x="183.14441"
       y="410.57373"
       width="32.979733"
       height="14.547639"
       id="rect22-2-0" /><rect
       x="183.14441"
       y="410.57374"
       width="24.505575"
       height="14.310555"
       id="rect3" /></defs><sodipodi:namedview
     id="namedview1"
     pagecolor="#ffffff"
     bordercolor="#000000"
     borderopacity="0.25"
     inkscape:showpageshadow="2"
     inkscape:pageopacity="0.0"
     inkscape:pagecheckerboard="0"
     inkscape:deskcolor="#d1d1d1"
     inkscape:lockguides="false"
     inkscape:document-units="mm"
     showguides="true"
     inkscape:zoom="1.8140803"
     inkscape:cx="100.0507"
     inkscape:cy="221.04865"
     inkscape:window-width="1792"
     inkscape:window-height="1009"
     inkscape:window-x="0"
     inkscape:window-y="25"
     inkscape:window-maximized="0"
     inkscape:current-layer="layer-MC1"
     showgrid="false"><inkscape:page
       x="0"
       y="0"
       inkscape:label="1"
       id="page1"
       width="340.15732"
       height="436.53601"
       margin="0 336.15732 432.53601 0"
       bleed="0"
       inkscape:export-filename="Double_BB_PE.svg"
       inkscape:export-xdpi="300"
       inkscape:export-ydpi="300" /><sodipodi:guide
       position="0,436.53601"
       orientati.........完整代码请登录后点击上方下载按钮下载查看

网友评论0