如何创建类似 iOS 的具有 NO/YES 状态的滑动按钮,当它为 YES 时打开模式窗口?
这可以用引导程序完成吗?
我找到了可以使用的代码,但我需要有人编辑 JS 代码,以便仅在按钮 YES 状态下显示模态。
HTML
<div>
Change status:
<input type="checkbox" class="switch" id="myswitch" checked />
</div>
<!-- Modal -->
<div class="modal fade" id="showModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
This is the modal
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
JS
$(document).ready(function() {
$("#myswitch").bootstrapSwitch();
$('#myswitch').on('switchChange.bootstrapSwitch', function(e, data) {
$('#showModal').modal('show');
});
});