js+css实现无视规则可拖拽的滑块取值器代码

代码语言:html

所属分类:拖放

代码描述:js+css实现无视规则可拖拽的滑块取值器代码,可拖拽滑块环子取下来物理落下,自由拖拽套上。

代码标签: js css 无视 规则 拖拽 滑块 取值器 代码

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

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

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

<style>
* {
  box-sizing: border-box;
}

:root {
  --bg-1: #171c34;
  --bg-2: #090b14;
  --track-a: #4e7bff;
  --track-b: #8b5dff;
  --track-c: #ff5bbd;
  --text: #f7f7ff;
  --muted: rgba(255, 255, 255, 0.65);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --knob-size: 46px;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(
    circle at top,
    #27305d 0%,
    var(--bg-1) 28%,
    var(--bg-2) 78%
  );
}

body {
  display: grid;
  place-items: center;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.scene {
  width: min(92vw, 860px);
  display: grid;
  place-items: center;
  padding: 32px 20px 80px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.slider-wrap {
  width: min(82vw, 620px);
  touch-action: none;
}

.labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding: 0 2px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.slider-shell {
  position: relative;
  height: 82px;
  display: flex;
  align-items: center;
  touch-action: none;
}

.track {
  position: relative;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.15),
      rgba(255, 255, 255, 0.04)
    ),
    linear-gradient(
      90deg,
      var(--track-a) 0%,
      var(--track-b) 48%,
      var(--track-c) 100%
    );
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.14),
    inset 0 -4px 8px rgba(0, 0, 0, 0.35), 0 12px 28px rgba(0, 0, 0, 0.32);
  overflow: visible;
  touch-action: none;
}

.track::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0.05)
  );
  pointer-events: none;
}

.fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 35%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8fb1ff 0%, #c291ff 55%, #ff9edb 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3),
    0 0 18px rgba(149, 126, 255, 0.32);
  pointer-events: none;
}

.end-glow {
  position: absolute;
  top: 50%;
  width: 52px;
  height: 52.........完整代码请登录后点击上方下载按钮下载查看

网友评论0