最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Bootstrap對話框使用實(shí)例講解

 更新時(shí)間:2016年09月24日 14:26:39   作者:hakase  
這篇文章主要為大家詳細(xì)介紹了Bootstrap對話框使用實(shí)例,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

使用模態(tài)框的彈窗組件需要三層 div 容器元素

分別為 modal(模態(tài)聲明層) dialog(窗口聲明層) content(內(nèi)容層)

在內(nèi)容層里面,還有三層,分別為 header(頭部)、 body(主體)、 footer(注腳) 

一個(gè)簡單的對話框登陸/注冊例子

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>Document</title>
 <link rel="stylesheet" href="./css/bootstrap.min.css">
 <script src="./js/jquery.min.js"></script>
 <script src="./js/bootstrap.min.js"></script>
 <style>
  .modal-dialog {
   width: 20%;
  }

  .modal-footer, .modal-header {
   text-align: center;
  }

  input {
   width: 80%;
  }

 </style>
</head>
<body>
 <!-- LOGIN MODULE -->
 <div id="loginModal" class="modal fade" tabindex="-1">
  <div class="modal-dialog">
   <div class="modal-content">
    <div class="modal-header">
     <button type="button" class="close" data-dismiss="modal">
      <span>&times;</span>
     </button>
     <h4 class="modal-title">會員登錄</h4>
    </div>
    <div class="modal-body">
     <label for="log_uname">
      <span>帳號:</span>
      <input id="log_uname" name="log_uname" type="text" placeholder="input your account">
     </label>
     <br>
     <label for="log_passwd">
      <span>密碼:</span>
      <input id="log_passwd" name="log_passwd" type="password" placeholder="input your password">
     </label>
    </div>
    <div class="modal-footer">
     <button type="button" class="btn btn-primary">登錄</button>
     <button type="button" class="btn btn-warning" data-dismiss="modal">退出</button>
    </div>
   </div>
  </div>
 </div>

 <!-- LOGIN MODULE -->
 <div id="registerModal" class="modal fade" tabindex="-1">
  <div class="modal-dialog">
   <div class="modal-content">
    <div class="modal-header">
     <button type="button" class="close" data-dismiss="modal">
      <span>&times;</span>
     </button>
     <h4 class="modal-title">注冊會員</h4>
    </div>
    <div class="modal-body">
     <label for="uname">
      <span>帳號:</span>
      <input id="reg_uname" name="reg_uname" type="text" placeholder="input your account">
     </label>
     <br>
     <label for="reg_passwd">
      <span>密碼:</span>
      <input id="reg_passwd" name="reg_passwd" type="password" placeholder="input your password">
     </label>
     <label for="reg_confirm_passwd">
      <span>確認(rèn):</span>
      <input id="reg_confirm_passwd" name="reg_confirm_passwd" type="password" placeholder="confirm your password">
     </label>
    </div>
    <div class="modal-footer">
     <button type="button" class="btn btn-primary">注冊</button>
     <button type="button" class="btn btn-warning" data-dismiss="modal">退出</button>
    </div>
   </div>
  </div>
 </div>

 <button class="btn btn-primary" data-toggle="modal" data-target="#loginModal">登陸</button>
 <button class="btn btn-warning" data-toggle="modal" data-target="#registerModal">注冊</button>
</body>
</html>

對話框其他知識

jQuery方式聲明對話框

$('#myModal').modal({
 show : true,
 backdrop : false,
 keyboard : false,
 remote : 'index.html',
});

jQuery方式顯示對話框

$('#myBtn').on('click', function () {
 $('#myModal').modal('show');
});

對話框的事件

show.bs.modal  ==> 在show方法調(diào)用時(shí)立即觸發(fā)

shown.bs.modal  ==> 在模態(tài)框完全顯示出來并且CSS動畫完成之后觸發(fā)

hide.bs.modal ==> 在hide方法調(diào)用時(shí) 還未關(guān)閉隱藏時(shí)觸發(fā)

hidden.bs.modal ==> 在模態(tài)框完全隱藏之后并且CSS動畫完成之后觸發(fā)

$('#myModal').on('show.bs.modal', function () {
 alert('show !');
});

邊緣彈出框

<button class="btn btn-lg btn-danger" type="button" data-toggle="popover"
 title="彈出框" data-content="這是一個(gè)彈出框">點(diǎn)擊彈出/隱藏彈出框</button>
<script>
 $('button').popover();
</script>

其他方法

$('button').popover('show'); //顯示
$('button').popover('hide'); //隱藏
$('button').popover('toggle'); //反轉(zhuǎn)顯示和隱藏
$('button').popover('destroy'); //隱藏并銷毀

事件

show.bs.popover ==> 在調(diào)用show方法時(shí)觸發(fā)

shown.bs.popover ==> 在顯示整個(gè)彈窗時(shí)觸發(fā)

hide.bs.popover ===> 在調(diào)用hide方法時(shí)觸發(fā)

hidden.bs.popover ==> 在完全關(guān)閉整個(gè)彈出時(shí)觸發(fā)

如果大家還想深入學(xué)習(xí),可以點(diǎn)擊這里進(jìn)行學(xué)習(xí),再為大家附兩個(gè)精彩的專題:Bootstrap學(xué)習(xí)教程 Bootstrap實(shí)戰(zhàn)教程

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

石门县| 沁水县| 青冈县| 栾川县| 三台县| 黔西| 新沂市| 简阳市| 湘阴县| 白玉县| 凯里市| 甘孜县| 武鸣县| 怀集县| 庆元县| 龙州县| 穆棱市| 珲春市| 依兰县| 噶尔县| 安化县| 顺昌县| 鄂尔多斯市| 奎屯市| 连州市| 红桥区| 蓝山县| 湟源县| 明水县| 凤山县| 景泰县| 弥渡县| 台东县| 永州市| 同德县| 大同市| 青川县| 万山特区| 昆山市| 无棣县| 资源县|