remove div.handle from checkbox

This commit is contained in:
Adam Bradley
2013-10-17 11:47:19 -05:00
parent 02cf3872a1
commit 72d37f9111
2 changed files with 48 additions and 38 deletions

View File

@ -4,46 +4,56 @@
display: inline-block; display: inline-block;
padding: ($checkbox-height / 4) ($checkbox-width / 4); padding: ($checkbox-height / 4) ($checkbox-width / 4);
cursor: pointer; cursor: pointer;
}
input { .checkbox input {
display: none; position: relative;
} width: $checkbox-width;
height: $checkbox-height;
border: 0;
background: transparent;
cursor: pointer;
-webkit-appearance: none;
/* what the checkbox looks like when its not checked */ &:before {
.handle { /* what the checkbox looks like when its not checked */
width: $checkbox-width; display: table;
height: $checkbox-height; width: 100%;
height: 100%;
border: $checkbox-border-width solid $checkbox-off-border-color; border: $checkbox-border-width solid $checkbox-off-border-color;
border-radius: $checkbox-border-radius; border-radius: $checkbox-border-radius;
background: $checkbox-off-bg-color; background: $checkbox-off-bg-color;
content: ' ';
transition: background-color .1s ease-in-out; transition: background-color .1s ease-in-out;
} }
}
/* the checkmark within the box */
.handle:after { /* the checkmark within the box */
position: absolute; .checkbox input:after {
top: 37%; position: absolute;
left: $checkbox-width / 2; top: 37%;
width: $checkbox-width / 2; left: 26%;
height: $checkbox-width / 4; display: table;
border: $checkbox-check-width solid $checkbox-check-color; width: $checkbox-width / 2;
border-top: none; height: $checkbox-width / 4;
border-right: none; border: $checkbox-check-width solid $checkbox-check-color;
content: ''; border-top: none;
opacity: 0; border-right: none;
transition: opacity .05s ease-in-out; content: ' ';
opacity: 0;
-webkit-transform: rotate(-45deg); transition: opacity .05s ease-in-out;
transform: rotate(-45deg);
} -webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
/* what it looks like when it is checked */ }
input:checked + .handle {
background: $checkbox-on-bg-color; /* what the background looks like when its checked */
.checkbox input:checked:before {
&:after { border: 0;
opacity: 1; background: $checkbox-on-bg-color;
} }
}
/* what the checkmark looks like when its checked */
.checkbox input:checked:after {
opacity: 1;
} }

View File

@ -20,17 +20,15 @@
<ul class="list"> <ul class="list">
<li class="list-item"> <li class="list-item">
Airplane Mode Airplane Mode
<label class="checkbox" id="airplaneMode"> <div class="checkbox" id="airplaneMode">
<input type="checkbox" name="airplaneMode"> <input type="checkbox" name="airplaneMode">
<div class="handle"></div> </div>
</label>
</li> </li>
<li class="list-item"> <li class="list-item">
Do Not Disturb Do Not Disturb
<label class="checkbox" id="doNotDisturb"> <div class="checkbox" id="doNotDisturb">
<input type="checkbox" name="doNotDisturb" checked="checked"> <input type="checkbox" name="doNotDisturb" checked="checked">
<div class="handle"></div> </div>
</label>
</li> </li>
</ul> </ul>
@ -38,5 +36,7 @@
</div> </div>
<script src="../dist/js/ionic.js"></script>
</body> </body>
</html> </html>