bootstrap中的data-toggle模态框相关
⼀,点击即打开
1,点击按钮
<a href="javascript:void(0)" class="btn btn-primary" data-toggle="modal" data-target="#test" onclick="toApiTestPage()">API测试⼯具</a> 2,模态框
<div class="modal fade" id="test" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document" >
<div class="modal-content bgwhite">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<i class="fa fa-times-circle" aria-hidden="true"></i>
</button>
<h4 class="modal-title" id="myModalLabel2">API测试</h4>
</div>
<div class="modal-body requestDiv" >
<ul class="ul-tab">
<li>
<strong>接⼝地址</strong>
<span id="apiUrl"></span>
<input id="requestApiUrl" type="hidden"/>
</li>
</ul>
</div>
<div class="modal-footer center">
<a href="javascript:void(0)" class="btn btn-primary" data-dismiss="modal">完成调试</a>
<a href="javascript:void(0)" class="btn btn-default" data-dismiss="modal">取消</a>
</div>
</div>
</div>
</div>
点击1中的"API测试⼯具"即可打开弹窗
⼆,点击的先调⽤js⽅法判断是否要打开
1,点击按钮:相⽐⼀.1 去掉了[data-toggle="modal" data-target="#test"]
<a href="javascript:void(0)" class="btn btn-primary" onclick="toApiTestPage()">API测试⼯具</a>
2,弹窗不变
3,在⽅法toApiTestPage()中
function toApiTestPage(){
if (满⾜条件){
//此时打开弹窗
$("#test").modal("show");
}else {
$("#test").modal("hide");
}
javascript void 0 是什么意思}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论