使用Twitter Bootstrap关闭警报无法正常工作? [英] Alert dismissing using Twitter Bootstrap is not working?

查看:82
本文介绍了使用Twitter Bootstrap关闭警报无法正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Chrome。

使用 Twitter Bootstrap ,我想添加一个简单的警报,不幸的是警报没有消失!

I'm using Google Chrome.
Using Twitter Bootstrap, I want to add a simple alert, unfortunately the alert is not dismissing when the x is pressed!

这是我基于 alert 文档的代码:

Here's my code based on alert documentation:

<!DOCTYPE html>
<html>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
  </head>
  <body>    
    <div class="alert">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>Warning!</strong> Best check yo self, you're not looking too good.
    </div>      
  </body>
</html>

我也尝试过:

<!DOCTYPE html>
  <html>
    <head>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
      <!-- Bootstrap -->
      <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
    </head>
    <body>    
    <div class="alert">
        <a href="#" class="close" data-dismiss="alert">×</a>
        <strong>Warning!</strong> Best check yo self, you're not looking too good.
    </div>      
    </body>
  </html>

缺少什么才能将其关闭?

What is missing to make it dismiss ?

推荐答案

感谢 davidkonrad 的评论。

解决方案很简单,只需添加以下内容:

Thanks to davidkonrad's comment.
The solution is trivial, by adding:

    <script src="js/bootstrap.min.js"></script>

这篇关于使用Twitter Bootstrap关闭警报无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆