css+js实现带刻度滑动拖动数字选择效果代码
代码语言:html
所属分类:选择器
代码描述:css+js实现带刻度滑动拖动数字选择效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #222237;
display: flex;
justify-content: center;
min-height: 100vh;
user-select: none;
-webkit-font-smoothing: antialiased;
font-family: "Microsoft YaHei UI", \82f9\65b9, Helvetica, Arial Light;
overflow: hidden;
}
h1 {
margin: 1.5em 0 0.5em;
color: #eee;
font-size: 1.5em;
padding: 0.625em;
font-weight: normal;
}
ul {
width: 100vw;
min-width: 100px;
}
ul li {
list-style: none;
font-size: 2.75em;
height: 60px;
text-align: center;
cursor: inherit;
}
section {
width: 100vw;
display: flex;
align-items: center;
flex-direction: column;
}
section h1 {
width: 100%;
color: #CC3300;
text-align: center;
}
.container {
position: relative;
height: 18.75em;
width: 90vw;
max-width: 400px;
display: flex;
justify-content: center;
overflow: hidden;
cursor: grab;
border-radius: 0.5em;
box-shadow: 0 0 50px 0 #00000038;
-webkit-mask: linear-gradient(0deg, transparent, #000, transparent);
box-shadow: inset 0 0 50px 0 #00000038;
}
.container.grabbing {
cursor: grabbing;
}
.time-picker {
width: 100%;
display: flex;
flex-direction: row;
transform: translateY( calc( var(--top) * 1px) );
}
.time-picker ul li {
color: #CC6666;
width: 100%;
text-align: center;
}
.clip {
position: absolute;
display: flex;
top: 120px;
height: 60px;
overflow: hidden;
}
.clip::before {
content: '';
position: absolute;
left: calc( 50% - 5em );
top: calc( 50% - 0.5em );
width: 0;
height: 0;
border-left: 1em solid #CC3300;
border-right: 0;
border-top: 0.5em solid transparent;
border-bottom: 0.5em solid transparent;
}
.clip::after {
content: '';
position: absolute;
right: calc( 50% - 5em );
top: calc( 50% - 0.5em );
width: 0;
height: 0;
border-left: 0;
border-right: 1em solid #CC3300;
border-top: 0.5em solid transparent;
border-bottom: 0.5em solid transparent;
}
.clip .wrapper {
--num: 0;
margin-top: -120px;
transform: translateY( calc( var(--num) * -60px ) );
}
.clip ul li {
color: #CC3300;
}
.transition-half-sec {
transition:transform .3s;
}
.tip {
margin-top: 2em;
color: #417096;
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0