mdb-ui-kit/less/_checkboxes.less

256 lines
5.9 KiB
Plaintext
Raw Normal View History

2014-08-18 18:25:33 +04:00
.form-horizontal .checkbox {
padding-top: 20px;
2014-08-18 18:25:33 +04:00
}
.checkbox {
label {
padding-left: 10px;
2014-08-18 18:25:33 +04:00
cursor: pointer;
position: relative;
span {
display: block;
position: absolute;
2014-09-17 12:56:21 +04:00
left: 0px;
2014-08-18 18:25:33 +04:00
transition-duration: 0.2s;
}
2014-10-30 11:34:53 +03:00
.ripple {
display: block;
position: absolute;
content: "";
background-color: rgba(0,0,0,.84);
left: -8px;
top: -11px;
height: 50px;
width: 50px;
border-radius: 100%;
z-index: 1;
opacity: 0;
margin: 0;
}
input[type=checkbox]:not(:checked) ~ .ripple {
animation: rippleOff 500ms;
}
input[type=checkbox]:checked ~ .ripple {
animation: rippleOn 500ms;
}
.check {
display: inline-block;
width: 20px;
height: 20px;
border: 2px solid;
border-radius: 2px;
overflow: hidden;
position: relative;
top: 5px;
left: -3px;
2014-10-30 11:34:53 +03:00
margin-right: 11px;
}
2014-09-17 12:56:21 +04:00
.check:after {
display: block;
position: absolute;
content: "";
background-color: @lightbg-text;
left: -5px;
top: -15px;
height: 50px;
width: 50px;
2014-08-18 18:25:33 +04:00
border-radius: 100%;
z-index: 1;
opacity: 0;
margin: 0;
2014-08-18 18:25:33 +04:00
}
2014-09-17 12:56:21 +04:00
.check:before {
position: absolute;
2014-09-17 12:56:21 +04:00
content: "";
transform: rotate(45deg);
display: block;
margin-top: -4px;
margin-left: 6px;
width: 0;
height: 0;
box-shadow:
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0px 0px 0 0px inset;
animation: checkbox-off 0.3s linear forwards;
2014-08-18 18:25:33 +04:00
}
}
2014-08-18 18:25:33 +04:00
// Hide native checkbox
2014-09-29 11:19:20 +04:00
input[type=checkbox] { opacity: 0; }
2014-09-29 11:19:20 +04:00
input[type=checkbox]:focus ~ .check:after {
opacity: 0.2;
}
input[type=checkbox]:checked ~ .check {
}
2014-09-17 12:56:21 +04:00
input[type=checkbox]:checked ~ .check:before {
box-shadow:
0 0 0 10px,
10px -10px 0 10px,
32px 0px 0 20px,
0px 32px 0 20px,
-5px 5px 0 10px,
20px -12px 0 11px;
animation: checkbox-on 0.3s linear forwards;
}
// Ripple effect on click
2014-09-17 12:56:21 +04:00
input[type=checkbox]:not(:checked) ~ .check:after {
2014-10-02 13:36:05 +04:00
animation: rippleOff 500ms linear forwards;
}
2014-09-17 12:56:21 +04:00
input[type=checkbox]:checked ~ .check:after {
2014-10-02 13:36:05 +04:00
animation: rippleOn 500ms linear forwards;
}
// Make animate quickly when not hover
&:not(:hover) input[type=checkbox] ~ .check {
2014-10-02 13:36:05 +04:00
&:before, &:after {
animation-duration: 1ms;
}
}
// Style for disabled inputs
2014-10-30 11:34:53 +03:00
input[type=checkbox][disabled]:not(:checked) ~ .check:before,
input[type=checkbox][disabled] ~ .circle {
opacity: 0.5;
}
2014-09-17 12:56:21 +04:00
input[type=checkbox][disabled] ~ .check:after {
background-color: @lightbg-text;
2014-09-17 12:56:21 +04:00
transform: rotate(-45deg);
2014-08-18 18:25:33 +04:00
}
2014-09-17 12:56:21 +04:00
.variations(~" input[type=checkbox]:checked ~ .check:after", background-color, @success);
.variations(~" input[type=checkbox]:checked ~ .check:before", color, #4caf50);
.variations(~" input[type=checkbox]:checked ~ .check", color, #4caf50);
}
@keyframes checkbox-on {
0% {
box-shadow:
0 0 0 10px,
10px -10px 0 10px,
32px 0px 0 20px,
0px 32px 0 20px,
-5px 5px 0 10px,
15px 2px 0 11px;
}
50% {
box-shadow:
0 0 0 10px,
10px -10px 0 10px,
32px 0px 0 20px,
0px 32px 0 20px,
-5px 5px 0 10px,
20px 2px 0 11px;
}
100% {
box-shadow:
0 0 0 10px,
10px -10px 0 10px,
32px 0px 0 20px,
0px 32px 0 20px,
-5px 5px 0 10px,
20px -12px 0 11px;
2014-08-18 18:25:33 +04:00
}
}
@keyframes checkbox-off {
0% {
box-shadow:
0 0 0 10px,
10px -10px 0 10px,
32px 0px 0 20px,
0px 32px 0 20px,
-5px 5px 0 10px,
20px -12px 0 11px,
0 0 0 0 inset;
}
2014-09-30 15:57:49 +04:00
25% {
box-shadow:
0 0 0 10px,
10px -10px 0 10px,
32px 0px 0 20px,
0px 32px 0 20px,
-5px 5px 0 10px,
20px -12px 0 11px,
0 0 0 0 inset;
}
50% {
transform: rotate(45deg);
margin-top: -4px;
margin-left: 6px;
width: 0px;
height: 0px;
box-shadow:
0 0 0 10px,
10px -10px 0 10px,
32px 0px 0 20px,
0px 32px 0 20px,
-5px 5px 0 10px,
15px 2px 0 11px,
0 0 0 0 inset;
2014-10-02 13:36:05 +04:00
}
51% {
transform: rotate(0deg);
margin-top: -2px;
margin-left: -2px;
width: 20px;
height: 20px;
box-shadow:
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0px 0px 0 10px inset;
2014-10-02 13:36:05 +04:00
}
100% {
transform: rotate(0deg);
margin-top: -2px;
margin-left: -2px;
width: 20px;
height: 20px;
box-shadow:
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0 0 0 0,
0px 0px 0 0px inset;
2014-10-02 13:36:05 +04:00
}
}
2014-10-30 11:34:53 +03:00
@keyframes rippleOn {
0% {
opacity: 0;
}
50% {
opacity: 0.2;
}
100% {
opacity: 0;
}
}
@keyframes rippleOff {
0% {
opacity: 0;
}
50% {
opacity: 0.2;
}
100% {
opacity: 0;
}
}