javascript - 在反应中用滑块填充输入类型范围
问题描述
我正在尝试构建和输入类型range
,当拇指向右侧增长时,轨道会填充新颜色。
在过去,我曾经使用普通的 JS 和 CSS 来做到这一点。
@media screen and (-webkit-min-device-pixel-ratio: 0) {
input[type="range"] {
-webkit-appearance: none;
width: 100%;
background: transparent;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
}
input[type="range"]:focus {
outline: none;
}
input[type="range"]::-ms-track {
width: 100%;
cursor: pointer;
background: transparent;
border-radius: transparent;
color: transparent;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
background: var(--strongCyan);
border-radius: 30px;
box-shadow: -10px 5px 50px var(--strongCyan);
cursor: pointer;
height: 36px;
width: 36px;
margin-top: -14px;
}
input[type="range"]::-webkit-slider-runnable-track {
width: 100%;
height: 8.4px;
cursor: pointer;
background: var(--lightGrayishBlueEmptySideBar);
border-radius: 70px;
}
}
但现在有了反应,结果是: codeandbox
一开始我以为这可能是盒子阴影,但当我改变它时,什么也没有发生。
解决方案
推荐阅读
- javascript - 如何使用 useState() 更新 react-chartjs-2 绘图
- java - 开发一个 JPA 实体,它采用 oneToMany 关系并将值转换为与值匹配的列数
- javascript - 在与另一个 div 对齐时响应地更改 div 大小
- c# - 将一个面板的所有控件复制到另一个面板中
- java - 如何将 .wav 转换为在 Android Studio 中浮动?
- c - 使用 mingw 交叉编译 c 程序时如何包含外部库?
- image-processing - 为什么 JPEG 压缩未压缩图像与其原始图像不同(FFmpeg、NvJPEG、...)
- java - spring jpa 存储过程
- css - 在 c# 和 ASP.Net Core 上用 css 改变 Like 的心的颜色
- php - 用PHP中的首字母映射数组