bootstrap popup window

ref:

http://www.w3cschool.cc/bootstrap/bootstrap-v2-modal-plugin.html

http://getbootstrap.com/javascript/


example code:

<html>
<head>
<title> Date time picker </title>
<link href="bootstrap-3.3.4-dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="jquery-2.1.3.min.js"></script>
<script src="bootstrap-3.3.4-dist/js/bootstrap.min.js"></script>

</head>
<body>
  
  <!-- Large modal -->
  <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button>

  <div class="modal fade bs-example-modal-lg" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
      
      <div class="modal-content">
        <div class="modal-header"> 
          Large Modal
        </div>
        <div class="modal-body">
          ...
        </div>
        <div class="modal-footer"> 
          modal footer
        </div>
      </div>
    </div>
  </div>

  <!-- Small modal -->
  <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">Small modal</button>

  <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm">
      <div class="modal-content">
        ...
      </div>
    </div>
  </div>
  
<script> 
  var modal = $('#bs-example-modal-lg');
  console.log(modal);
  modal.on('show.bs.modal', function(){console.log("show");});
  modal.on('shown.bs.modal', function(){console.log("shown");});
</script>
</body>
</html>


following is the method to add event listener.

Just wanted to say that Bootstrap 3 handles this a bit differently. The event name is "shown.bs.modal".

$('#themodal').on('shown.bs.modal', function () {
   $("#txtname").focus();
});

or put the focus on the first visible input like this:

.modal('show').on('shown.bs.modal', function ()
{
    $('input:visible:first').focus();
})

http://getbootstrap.com/javascript/#modals

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值