UNPKG

zent

Version:

一套前端设计语言和基于React的实现

186 lines (182 loc) 4.33 kB
/*switch通用*/ .zent-switch { position: relative; display: inline-block; box-sizing: border-box; width: 70px; height: 40px; line-height: 20px; vertical-align: middle; border-radius: 20px; border: 1px solid #999999; background-color: #999999; cursor: pointer; -webkit-transition: all 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); transition: all 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); } .zent-switch .zent-switch-inner { color: #fff; font-size: 12px; position: absolute; left: 39px; top: 9px; -webkit-transition: left 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); transition: left 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .zent-switch:after { position: absolute; width: 34px; height: 34px; left: 2px; top: 2px; border-radius: 100%; background-color: #fff; content: " "; cursor: pointer; -webkit-transition: left 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); transition: left 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86); } .zent-switch:focus { box-shadow: 0 0 0 2px fade(#44BB00, 20%); outline: 0; } .zent-switch:focus:hover { box-shadow: none; } /*大小相关*/ .zent-switch-large { height: 50px; line-height: 12px; width: 90px; border-radius: 50px; } .zent-switch-large .zent-switch-inner { font-size: 14px; left: 50px; top: 18px; } .zent-switch-large:after { width: 44px; height: 44px; top: 2px; left: 2px; } .zent-switch-large.zent-switch-checked .zent-switch-inner { font-size: 14px; left: 10px; top: 18px; } .zent-switch-large.zent-switch-checked:after { left: 42px; } .zent-switch-small{ width: 35px; height: 20px; line-height: 10px; } .zent-switch-small .zent-switch-inner { display: none; } .zent-switch-small:after { width: 16px; height: 16px; top: 1px; left: 1px; } .zent-switch-small.zent-switch-checked:after { left: 16px; } /*状态相关*/ .zent-switch-checked { border-color: #44BB00; background-color: #44BB00; } .zent-switch-checked .zent-switch-inner { left: 6px; top: 9px; } .zent-switch-checked::after { left: 32px; } .zent-switch-disabled { cursor: not-allowed; background: #F2F2F2; border-color: #F2F2F2 } .zent-switch-disabled.zent-switch-checked { background: #83E5A7; border-color: #83E5A7; } .zent-switch-disabled::after { background: #FFFFFF; cursor: not-allowed; } .zent-switch-loading { position: relative; color: transparent; cursor: not-allowed /* 小switch暂不显示loading */ } .zent-switch-loading::after { cursor: not-allowed; } .zent-switch-loading.zent-switch-small {} .zent-switch-loading.zent-switch-small::before { display: none!important; } .zent-switch-loading.zent-switch-large {} .zent-switch-loading.zent-switch-large::before { margin: -5px 0 0 -17px; } .zent-switch-loading.zent-switch-large.zent-switch-checked {} .zent-switch-loading.zent-switch-large.zent-switch-checked::before { margin: -5px 0 0 23px; } .zent-switch-loading.zent-switch-checked {} .zent-switch-loading.zent-switch-checked::before { margin: -5px 0 0 15px; } .zent-switch-loading::before { content: ' '; position: absolute; top: 43%; left: 38%; z-index: 2; width: 16px; height: 16px; margin: -5px 0 0 -15px; border: 3px solid rgba(0, 0, 0, 0.1); border-radius: 100%; box-sizing: border-box; } .zent-switch-loading::before { border-color: #666666 transparent transparent transparent; -webkit-animation: switch-spin 0.6s linear; animation: switch-spin 0.6s linear; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; } @-webkit-keyframes switch-spin { 0% { -webkit-transform: rotate(0); transform: rotate(0) } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg) } } @keyframes switch-spin { 0% { -webkit-transform: rotate(0); transform: rotate(0) } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg) } }