gpt4 book ai didi

html - 支持 Microsoft Edge 的多范围 slider

转载 作者:行者123 更新时间:2023-11-27 22:56:39 24 4
gpt4 key购买 nike

我正在创建一个多范围 slider ,使用 2 个 slider 并使它们相互重叠。

我已成功创建它并在 Chrome 和 Mozilla 中支持它,但我似乎无法支持 Edge。

样式在 SCSS 中。

<!DOCTYPE html>
<html lang="en">
<head>
<style lang="scss">
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}

.item-value {
display: flex;
position: relative;
width: 100%;
height: 20px;
display: flex;
align-items: center;

&::before {
content: '';
height: 5px;
background: #000;
width: 100%;
background: #ddd;
border-radius: 3px;
}

.min-range, .max-range {
height: 25px;
width: 100%;
margin: 0;
padding: 0;
border: 0;
outline: none;
background: transparent;
-webkit-appearance: none;
-moz-appearance: none;
pointer-events: none; // Prevent mouse interaction on the range slider.
position: absolute;

/* For Webkit Browsers (Chrome) */
&::-webkit-slider-runnable-track {
cursor: default;
height: 5px;
outline: 0;
appearance: none;
background: #ddd;
border-radius: 3px;
position: relative;
}

&::-webkit-slider-thumb {
-webkit-appearance: none;
pointer-events: all;
background: $red;
width: 25px;
height: 25px;
border-radius: 50%;
top: -10px;
position: absolute;
z-index: 10;
cursor: pointer;
}

/* For Mozilla Browsers */
&::-moz-range-track {
opacity: 0;
pointer-events: none;
}

&::-moz-range-thumb {
-webkit-appearance: none;
pointer-events: all;
background: $red;
width: 25px;
height: 25px;
border-radius: 50%;
top: -5px;
position: absolute;
z-index: 10;
cursor: pointer;
border: 0;
}

/* For Edge Browsers */
&::-ms-track {
pointer-events: all;
}

&::-ms-thumb {
border: none;
height: 25px;
width: 25px;
border-radius: 50%;
background: $red;
pointer-events: all;
}

&::-ms-tooltip {
display: none;
pointer-events: all;
}
}
}
}
</style>
</head>

<body>
<section class="item-value">
<input type="range" value="10" class="min-range">
<input type="range" value="10" class="max-range">
</section>
</body>
</html>

在 &::-ms-thumb {} 中,指针事件:全部;不工作,

我希望它重新启用指针事件,以便可以再次使用句柄,这发生在 &::-webkit-slider-thumb {} 和 &::-moz-range-thumb {}

最佳答案

添加相同的 html 和 css 代码使其可在此处运行

<!DOCTYPE html>
<html lang="en">
<head>
<style lang="scss">
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}

.item-value {
display: flex;
position: relative;
width: 100%;
height: 20px;
display: flex;
align-items: center;

&::before {
content: '';
height: 5px;
background: #000;
width: 100%;
background: #ddd;
border-radius: 3px;
}

.min-range, .max-range {
height: 25px;
width: 100%;
margin: 0;
padding: 0;
border: 0;
outline: none;
background: transparent;
-webkit-appearance: none;
-moz-appearance: none;
pointer-events: none; // Prevent mouse interaction on the range slider.
position: absolute;

/* For Webkit Browsers (Chrome) */
&::-webkit-slider-runnable-track {
cursor: default;
height: 5px;
outline: 0;
appearance: none;
background: #ddd;
border-radius: 3px;
position: relative;
}

&::-webkit-slider-thumb {
-webkit-appearance: none;
pointer-events: all;
background: $red;
width: 25px;
height: 25px;
border-radius: 50%;
top: -10px;
position: absolute;
z-index: 10;
cursor: pointer;
}

/* For Mozilla Browsers */
&::-moz-range-track {
opacity: 0;
pointer-events: none;
}

&::-moz-range-thumb {
-webkit-appearance: none;
pointer-events: all;
background: $red;
width: 25px;
height: 25px;
border-radius: 50%;
top: -5px;
position: absolute;
z-index: 10;
cursor: pointer;
border: 0;
}

/* For Edge Browsers */
&::-ms-track {
pointer-events: all;
}

&::-ms-thumb {
border: none;
height: 25px;
width: 25px;
border-radius: 50%;
background: $red;
pointer-events: all;
}

&::-ms-tooltip {
display: none;
pointer-events: all;
}
}
}
}
</style>
</head>

<body>
<section class="item-value">
<input type="range" value="10" class="min-range">
<input type="range" value="10" class="max-range">
</section>
</body>
</html>

关于html - 支持 Microsoft Edge 的多范围 slider ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59225524/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com