css实现别针引脚开关切换交互效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现别针引脚开关切换交互效果代码

代码标签: 引脚 开关 切换 交互 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">


  
  
<style>
* {
  box-sizing: border-box;
}

body, html {
  width: 100%;
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #3a49fd;
}

.toggle-wrapper {
  padding: 16px;
  position: relative;
}

.toggle-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  outline: none;
}
.toggle-input:checked + label {
  background-color: #fff;
}
.toggle-input:checked + label > .toggle-circle {
  left: calc(100% - 44px);
}
.toggle-input:checked + label > .toggle-circle .pin-icon {
  transform: rotate(0);
}
.toggle-input:checked + label > .toggle-circle .pin-top {
  -webkit-animation: pushPinTop 0.4s ease-in-out 0.55s;
          animation: pushPinTop 0.4s ease-in-out 0.55s;
}
.toggle-input:checked + label > .toggle-circle .pin-middle, .toggle-input:checked + label > .toggle-circle .pin-bottom:before {
  -webkit-animation: pushPin 0.4s ease-in-out 0.55s;
          animation: pushPin 0.4s ease-in-out 0.55s;
}

.toggle-container {
  border-radius: 30px;
  display: block;
  width: 100px;
  height: 40px;
  background-color: #1018a4;
  position: relative;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.35, 0.4, 0.45, 0.2);
}

.toggle-circle {
  position: absolute;
  top: 50%;
  left: -4px;
  transform: translatey(-50%);
  background-color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow: rgba(0, 0, 0, 0.2) 0px 12px 28px 0px, rgba(0, 0, 0, 0.1) 0px 2px 4px 0px, rgba(255, 255, 255, 0.05) 0px 0px 0px 1px inset;
  transition: all 0.3s cubic-bezier(0.33, 0.44, 0.45, 1.65);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #041043;
}

.pin-icon {
  transition: all 0.2s ease-in-out;
  transition-delay: 0.4s;
  width: 24px;
  height: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: rotate(45deg);
  position: relative;
}
.pin-icon span {
  flex-shrink: 0;
  position: relative;
}

.pin-top {
  display: inline-block;
  border-radius: 4px;
  b.........完整代码请登录后点击上方下载按钮下载查看

网友评论0