js+css实现立体质感rgb滑竿slider调节拖动器代码

代码语言:html

所属分类:拖放

代码描述:js+css实现立体质感rgb滑竿slider调节拖动器代码

代码标签: js css 立体 质感 rgb 滑竿 slider 调节 拖动

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

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

<head>
  <meta charset="UTF-8">

  
<style>
body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  row-gap: 2em;
  min-height: 100vh;
  background-color: #323232;
  font-size: 2em;
}

.slider {
  --slider-height: .375em;
  --slider-value: 0;
  display: flex;
  align-items: center;
  position: relative;
  border-radius: 3.125em;
  width: 10em;
}
.slider:nth-child(1) {
  --slider-color: #c52828;
}
.slider:nth-child(2) {
  --slider-color: #219328;
}
.slider:nth-child(3) {
  --slider-color: #2850c5;
}

.slider-track {
  display: flex;
  align-items: center;
  position: relative;
  border-radius: inherit;
  height: var(--slider-height);
  width: calc(100%);
  background-color: #262626;
  background-blend-mode: overlay, normal;
  box-shadow: inset 0 0.0625em 0.125em rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.1);
}

.slider-input {
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  transform: translate(-50%);
  border-radius: inherit;
  width: calc(100% + .875em);
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.slider-input::-webkit-slider-thumb {
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  padding: 0.5em;
  width: 1.25em;
  height: 1.25em;
}
.slider-input::-moz-range-thumb {
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  padding: 0.5em;
  width: 1.25em;
  height: 1.25em;
}

.slider-thumb {
  display: flex;
  position: absolute;
  left: calc(var(--slider-value) / 100 * (100% - var(--slider-height)) + var(--slider-height) / 2);
  border-radius: 0.0625em;
  width: 1.25em;
  height: 1.25em;
  transform: translateX(-50%);
  box-shadow: 0 0 0.25em 0.0625em rgba(0, 0, 0, 0.2), 0 0.25em 0.25em rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.slider-thumb-side {
  flex-grow: 37;
  height: 100%;
}
.slider-thumb-side:first-child {
  background-image: linear-gradient(to right, #252427 45%, #383836 55%);
  box-shadow: inset 0.03125em 0 0 0.03125em rgba(0, 0, 0, 0.3);
}
.slider-thumb-side:last-child {
  background-image: linear-gradient(to right, #383836 45%, #252427 55%);
  box-shadow: inset -0.03125em 0 0 0.03125em rgba(0, 0, 0, .........完整代码请登录后点击上方下载按钮下载查看

网友评论0