欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Bootstrap基本插件學(xué)習(xí)筆記之Alert警告框(20)

 更新時(shí)間:2016年12月08日 08:59:17   作者:kikay  
這篇文章主要為大家詳細(xì)介紹了Bootstrap基本插件學(xué)習(xí)筆記之ALert警告框的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

和前面的模態(tài)對(duì)話框類似。

0x01 例子

先看一個(gè)簡(jiǎn)單的例子:

<!DOCTYPE html>
<html lang="zh-cn">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link href="../../css/bootstrap.min.css" rel="stylesheet">
 <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
 <script src="../../js/bootstrap.min.js"></script>
 <title>警告框</title>
</head>
<body>
<div class="container">
 <div class="page-header">
 <h1>警告框</h1>
 </div>
 <div class="alert alert-danger fade in ">
 警告!服務(wù)器dang了
 <a href="#" class="close" data-dismiss="alert">&times;</a>
 </div>
</div>
</body>
</html>

效果如下:

0x02 事件

Alert警告框和模態(tài)對(duì)話框類似,也支持JS事件:

(1)close.bs.alert

當(dāng)調(diào)用 close 實(shí)例方法時(shí)立即觸發(fā)該事件:

$('#myalert').bind('close.bs.alert', function () {
 // 執(zhí)行一些動(dòng)作...
})

(2)closed.bs.alert

當(dāng)警告框被關(guān)閉時(shí)觸發(fā)該事件(將等待 CSS 過(guò)渡效果完成):

$('#myalert').bind('closed.bs.alert', function () {
 // 執(zhí)行一些動(dòng)作...
})

看一個(gè)例子:

<!DOCTYPE html>
<html lang="zh-cn">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link href="../../css/bootstrap.min.css" rel="stylesheet">
 <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
 <script src="../../js/bootstrap.min.js"></script>
 <title>警告框</title>
</head>
<body>
<div class="container">
 <div class="page-header">
 <h1>警告框</h1>
 </div>
 <div class="alert alert-danger fade in" id="myAlert">
 警告!服務(wù)器dang了
 <a href="#" class="close" data-dismiss="alert">&times;</a>
 </div>
</div>
<script>
 $(function () {
 $("#myAlert").bind('closed.bs.alert',function () {
  alert("警告消息框被關(guān)閉!");
 });
 })
</script>
</body>
</html>

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

Bootstrap學(xué)習(xí)教程

Bootstrap實(shí)戰(zhàn)教程

Bootstrap插件使用教程

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

相關(guān)文章

最新評(píng)論