mdui实现一个拖动时钟指针选择事件效果代码
代码语言:html
所属分类:选择器
代码描述:mdui实现一个拖动时钟指针选择事件效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/mdui.min.css">
<style>
html, body {
height: 100%;
}
body {
margin: 0;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
overflow-y: auto;
}
/*好看的更新动画*/
mdui-replaceable {
position: relative;
display: block;
}
mdui-replaceable > div {
box-sizing: border-box;
width: 100%;
}
mdui-replaceable > .replacement-wrapper {
position: absolute;
left: 0;
top: 0;
right: 0;
text-align: inherit;
}
/*选择器公用样式*/
.picker {
width: 330px;
box-shadow: 0 39px 56px 4px rgba(0, 0, 0, .24);
border-radius: 2px;
overflow: hidden;
background: white;
/*控件颜色*/
--preferred-color: #009688;
}
.picker > header {
width: 100%;
background: var(--preferred-color, #009688);
color: white;
}
.picker > header button {
text-align: left;
box-sizing: border-box;
border: none;
padding: 0;
background: none;
color: rgba(255, 255, 255, .7);
font-family: Roboto, -apple-system, PingFang SC, Noto Sans CJK SC, sans-serif;
font-size: 16px;
font-weight: 500;
height: 16px;
transition: all .3s cubic-bezier(0.2, 0.9, 0.4, 1);
}
.picker > header button.picker-toggle-active {
color: white;
}
.picker > footer > button {
color: var(--preferred-color, #009688)!important; /*MDUI对按钮的颜色设置会覆盖此属性*/
}
/*时间选择器*/
.picker.time-picker {
user-select: none;
}
.picker.time-picker > header {
box-sizing: border-box;
padding: 28px 48px 23px;
display: flex;
align-items: center;
justify-content: flex-end;
color: rgba(255, 255, 255, .7);
}
.picker.time-picker .time-picker--time-hour-switch, .picker.time-picker .time-picker--time-hour-switch > button {
font-size: 60px;
height: 45px;
line-height: 20px;
font-weight: 400;
}
.picker.time-picker .time-picker--am-pm-switch {
margin-left : 24px;
display: flex;
flex-direction: column;
justify-content: center;
}
.picker.time-picker .time-picker--am-pm-switch > button {
height: 12px;
line-height: 20px;
overflow: visible;
}
.picker.time-picker .time-picker--am-pm-switch > button+button {
margin-top: 11px;
}
.picker.time-picker .time-picker--selector {
position: relative;
box-sizing: border-box;
height: 296px;
width: 296px;
border-radius: 50%;
background: #EEEEEE;
margin: 33px auto 8px;
user-select: none;
padding: 14px;
}
.picker.time-picker .time-picker--selection-wrapper {
position: absolute;
z-index: 2;
width: 268px;
height: 268px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
transform: rotate(var(--selection-rotation));
}
.picker.time-picker .time-picker--selection-wrapper > span {
transform: rotate(calc( var(--selection-rotation) * -1 ));
font-size: 16px;
color: rgba(0, 0, 0, .87);
letter-spacing: .1px;
}
.picker.time-picker :is(.time-picker--indicator, .time-picker--indicator-inverted) {
position: absolute;
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0