mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
toggle within a list
This commit is contained in:
5
dist/css/ionic-scoped.css
vendored
5
dist/css/ionic-scoped.css
vendored
@ -2193,6 +2193,11 @@
|
||||
.ionic .toggle input:checked + .handle {
|
||||
background-color: white;
|
||||
-webkit-transform: translate3d(22px, 0, 0); }
|
||||
.ionic .list-item-buttons.toggle {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 15px;
|
||||
z-index: 3; }
|
||||
.ionic .radio-buttton-list .list-item-content {
|
||||
/* give some room to the right for the checkmark icon */
|
||||
padding-right: 60px; }
|
||||
|
||||
6
dist/css/ionic.css
vendored
6
dist/css/ionic.css
vendored
@ -2679,6 +2679,12 @@ input[type="checkbox"][readonly] {
|
||||
background-color: white;
|
||||
-webkit-transform: translate3d(22px, 0, 0); }
|
||||
|
||||
.list-item-buttons.toggle {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 15px;
|
||||
z-index: 3; }
|
||||
|
||||
.radio-buttton-list .list-item-content {
|
||||
/* give some room to the right for the checkmark icon */
|
||||
padding-right: 60px; }
|
||||
|
||||
@ -70,3 +70,10 @@
|
||||
background-color: $toggle-handle-on-bg-color;
|
||||
-webkit-transform: translate3d( $toggle-width - $toggle-handle-width - ($toggle-border-width * 2) ,0,0);
|
||||
}
|
||||
|
||||
.list-item-buttons.toggle {
|
||||
position: absolute;
|
||||
top: $list-item-padding / 3;
|
||||
right: $list-item-padding;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
@ -17,68 +17,51 @@
|
||||
|
||||
<main class="content has-header">
|
||||
|
||||
<ul class="list">
|
||||
<ul>
|
||||
<li class="list-item">
|
||||
Airplane Mode
|
||||
<label class="toggle" id="airplaneMode">
|
||||
<input type="checkbox" name="airplaneMode">
|
||||
<div class="list-item-content">
|
||||
Flux Capacitor
|
||||
</div>
|
||||
<label class="list-item-buttons toggle">
|
||||
<input type="checkbox" checked>
|
||||
<div class="handle"></div>
|
||||
</label>
|
||||
</label>
|
||||
</li>
|
||||
<li class="list-item">
|
||||
Do Not Disturb
|
||||
<label class="toggle" id="doNotDisturb">
|
||||
<input type="checkbox" name="doNotDisturb" checked="checked">
|
||||
<div class="list-item-content">
|
||||
1.21 Gigawatts
|
||||
</div>
|
||||
<label class="list-item-buttons toggle">
|
||||
<input type="checkbox" checked>
|
||||
<div class="handle"></div>
|
||||
</label>
|
||||
</label>
|
||||
</li>
|
||||
<li class="list-item">
|
||||
<div class="list-item-content">
|
||||
88 MPH
|
||||
</div>
|
||||
<label class="list-item-buttons toggle">
|
||||
<input type="checkbox" checked>
|
||||
<div class="handle"></div>
|
||||
</label>
|
||||
</li>
|
||||
<li class="list-item">
|
||||
<div class="list-item-content">
|
||||
Plutonium Resupply
|
||||
</div>
|
||||
<label class="list-item-buttons toggle">
|
||||
<input type="checkbox">
|
||||
<div class="handle"></div>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="margin">
|
||||
<p>
|
||||
<button id="btnTest1">Toggle Airplane Mode</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button id="btnTest2">Toggle Do Not Disturb</button>
|
||||
</p>
|
||||
|
||||
<p><a class="button button-secondary" href="index.html">Homepage</a></p>
|
||||
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="../dist/js/ionic.js"></script>
|
||||
|
||||
|
||||
<!-- for testing only -->
|
||||
<script>
|
||||
|
||||
$("#btnTest1").click(function(){
|
||||
var toggle = $("#airplaneMode");
|
||||
if( toggle.val() === true ) {
|
||||
toggle.val(false);
|
||||
} else {
|
||||
toggle.val(true);
|
||||
}
|
||||
});
|
||||
|
||||
$("#btnTest2").click(function(){
|
||||
var toggle = $("#doNotDisturb");
|
||||
val = toggle.val();
|
||||
return
|
||||
if( toggle.val() === true ) {
|
||||
toggle.val(false);
|
||||
} else {
|
||||
toggle.val(true);
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user