draggabilly实现一个胶囊开关checkbox美化效果代码

代码语言:html

所属分类:表单美化

代码描述:draggabilly实现一个胶囊开关checkbox美化效果代码

代码标签: 胶囊 开关 checkbox 美化 效果

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


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

<head>

  <meta charset="UTF-8">
  

  
  
<style>
/* Define active switch color */
/* Hide our checkboxes */
.check-switch input[type=checkbox] {
  position: absolute;
  opacity: 0;
}

label.check-switch {
  clear: both;
  color: #999;
  display: inline-block;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Default Track */
.check-switch input[type=checkbox] + .track {
  vertical-align: middle;
  width: 1.6588em;
  height: 0.95em;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.1);
  -webkit-transition-duration: 0.3s;
  -webkit-transition-property: background-color, box-shadow;
  box-shadow: inset 0 0 0 0px rgba(102, 5, 199, 0.75);
  margin: 0.5em 0 50px 0;
  cursor: pointer;
}

/* Default Track Checked */
.check-switch input[type=checkbox]:checked + div {
  background-color: #b36afb;
  border: 1px solid rgba(102, 5, 199, 0.85);
  box-shadow: inset 0 0 0 0.5em rgba(179, 106, 251, 0);
}

/* Default Knob */
.check-switch input[type=checkbox] + div > div {
  left: 0;
  width: 0.95em;
  height: 0.95em;
  border-radius: inherit;
  background: #ffffff;
  -webkit-transition-timing-function: cubic-bezier(0.54, 1.85, 0.5, 1);
  -webkit-transition-duration: 0.3s;
  -webkit-transition-property: transform, background-color, box-shadow;
  -moz-transition-timing-function: cubic-bezier(0.54, 1.85, 0.5, 1);
  -moz-transition-duration: 0.3s;
  -moz-transition-property: transform, background-color;
  box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0px 0px 0 1px rgba(0, 0, 0, 0.2);
  margin-top: 0;
}

/* Default Knob Checked */
.check-switch input[type=checkbox]:checked + div > div {
  left: 0.699em;
  background-color: #fff;
  box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(89, 4, 174, 0.5);
}

/* Fixes drag performance */
.check-switch .knob.is-dragging {
  -webkit-transition: none;
}

/* Demo page layout, not important */
body {
  -webkit-user-select: none;
  cursor: default;
  font: 22px "Helvetica Neue";
  color: rgba(0, 0, 0, 0.77);
  font-weight: 200;
  padding: 0 3em 5em 3em;
  background: -webkit-linear-gradient(top, #f2fbff 0%, #ffffff 64%) no-repeat;
  background: -moz-linear-gradient(top, #f2fbff 0%, #ffffff 64%) no-repeat;
  background: -ms-linear-gradient(top, #f2fbff 0%, #ffffff 64%) no-repeat;
  background: linear-gradient(to bottom, #f2fbff 0%, #ffffff 64%) no-repeat;
}

h1 {
  font-weight: 100;
  font-size: 3em;
  color: #999;
}

h2 {
  font-weight: 200;
  font-size: 22px;
  color: #8006f9;
}

h3 {
  font-weight: 200;
  font-size: 18px;
  color: rgba(0, 0, 0, 0.77);
  margin-top: 50px;
}

a:link {
  text-decoration: none;
  color: #f06;
}

a:visited {
  text-decoration: none;
  color: #f06;
}

a:hover {
  text-decoration: underline;
}

a:active {
  text-decoration: underline;
}

hr {
  border: 0;
  border-top: 1px solid #efefef;
}

p {
  color: #555;
  max-width: 35em;
  margin-top: 1em;
}

#main {
  clear: both;
  padding: 2em 2em 0;
}

h1 label {
  position: relative;
  top: 0.2em;
  display: block !important;
  width: 1.8em;
}
</style>




</head>

<body >
  <h1>
    <l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0