twitter-bootstrap Bootstrap 的关闭按钮不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16468675/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap's close button doesn't work
提问by Arnaud
I'm trying to display an alert message with a close button with Twitter Bootstrap. But it doesn't work with Chrome. So I created a jsFiddle : http://jsfiddle.net/6vD5j/3/, but strangely this jsFiddle doesn't work.
我正在尝试使用 Twitter Bootstrap 显示带有关闭按钮的警报消息。但它不适用于 Chrome。所以我创建了一个 jsFiddle :http: //jsfiddle.net/6vD5j/3/,但奇怪的是这个 jsFiddle 不起作用。
<div class='alert alert-error'>
<button type='button' class='close' data-dismiss='alert'>×</button>
Test
</div>
So I'm lost, and I require your help please.
所以我迷路了,我需要你的帮助。
[EDIT]If I run this locally on Chrome, it doesn't work :
[编辑]如果我在 Chrome 上本地运行它,它不起作用:
<?php echo "<link href='http://twitter.github.com/bootstrap/assets/css/bootstrap.css' rel='stylesheet' media='screen'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js'></script>
<script src='http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'></script>
<div class='alert alert-error'>
<button type='button' class='close' data-dismiss='alert'>x</button>
Test
</div>";
?>
回答by woz
Something was wrong with your bootstrap.js. I uploaded it again and now it works:
你的 bootstrap.js 有问题。我再次上传了它,现在它可以工作了:
You used 2.0.2, and I changed it to 2.3.1 which is the current version. My guess is that this functionality wasn't available in 2.0.2.
您使用的是 2.0.2,我将其更改为当前版本的 2.3.1。我的猜测是这个功能在 2.0.2 中不可用。
The HTML is the same:
HTML 是相同的:
<br><br>
<div class='alert alert-error'>
<button type='button' class='close' data-dismiss='alert'>×</button>
Test
</div>

