点击按钮即可。 但问题是,当页面打开时,它会自动出现,而我想只在按钮点击时才会出现这种情况。 测试模式
<div class="col-md-2"><center/><button class="btn btn-lg" data-toggle="modal" data-target="#myModal">TIME ZONE</button> </div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button>
<h4 class="modal-title" id="myModalLabel">
Time Zone </h4>
</div>
<div class="modal-body">
Add some text here
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
<script> $(function () { $('#myModal').modal({ keyboard: true })}); </script>
<script src="js/bootstrap.js"></script>
</body>
</html>
答案 0 :(得分:0)
试试这个。
<input type="button" id="btn"/>
$(function () {
$("#btn").click(function(){
$('#myModal').modal('show');
});
});