mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
64 lines
1.7 KiB
SCSS
64 lines
1.7 KiB
SCSS
|
|
/* the overall container of the toggle */
|
|
.toggle {
|
|
display: inline-block;
|
|
}
|
|
|
|
/* hide the actual checkbox */
|
|
.toggle input {
|
|
display: none;
|
|
}
|
|
|
|
/* the background of the toggle's track area */
|
|
/* also the track appearance when the toggle is "off" */
|
|
.toggle .track {
|
|
display: inline-block;
|
|
box-sizing: border-box;
|
|
width: $toggle-width;
|
|
height: $toggle-height;
|
|
border: solid $toggle-border-width $toggle-off-border-color;
|
|
border-radius: $toggle-border-radius;
|
|
background-color: $toggle-off-bg-color;
|
|
cursor: pointer;
|
|
|
|
transition-property: background-color, border;
|
|
transition-duration: $toggle-transition-duration;
|
|
transition-timing-function: ease-in-out;
|
|
}
|
|
|
|
/* the handle (circle) thats inside the toggle's track area */
|
|
/* also the appearance when the handle is "off" */
|
|
.toggle .handle {
|
|
position: absolute;
|
|
display: block;
|
|
width: $toggle-handle-width;
|
|
height: $toggle-handle-height;
|
|
border-radius: $toggle-handle-radius;
|
|
background-color: $toggle-handle-off-bg-color;
|
|
transition: -webkit-transform $toggle-transition-duration ease-in-out;
|
|
|
|
&:before {
|
|
position: absolute;
|
|
content: '.';
|
|
color: transparent;
|
|
left: ( ($toggle-handle-width / 2) * -1);
|
|
top: ( ($toggle-handle-height / 2) * -1) + 3;
|
|
padding: ($toggle-handle-height / 2) ($toggle-handle-width + 2);
|
|
}
|
|
}
|
|
|
|
|
|
/* When the toggle is "on" */
|
|
.toggle :checked + .track {
|
|
|
|
/* the track when the toggle is "on" */
|
|
border-color: $toggle-on-border-color;
|
|
background-color: $toggle-on-bg-color;
|
|
|
|
/* the handle when the toggle is "on" */
|
|
.handle {
|
|
background-color: $toggle-handle-on-bg-color;
|
|
-webkit-transform: translate3d( $toggle-width - $toggle-handle-width - ($toggle-border-width * 2) ,0,0);
|
|
}
|
|
}
|