Files
ionic-framework/scss/ionic/_toggle.scss
Adam Bradley 28113c1e6f toggle updates
2013-10-17 09:18:24 -05:00

68 lines
1.8 KiB
SCSS

// Toggle
// -------------------------------
/* the overall container of the toggle */
.toggle {
display: inline-block;
}
/* hide the actual <input type="checkbox"> */
.toggle input[type="checkbox"] {
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-timing-function: ease-in-out;
transition-duration: $toggle-transition-duration;
transition-property: background-color, border;
}
/* 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;
/* used to create a larger hit area to slide the handle */
&:before {
position: absolute;
top: -2px;
left: ( ($toggle-handle-width / 2) * -1) - 2;
display: table;
padding: ($toggle-handle-height / 2) + 3 ($toggle-handle-width + 2);
content: " ";
}
}
/* 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);
}
}