admin管理员组文章数量:1026470
Im using the following alert and I want it to be toggle after 2 sec,how should I do that ?
<div class="alert alert-info">
<a href="#" class="close" data-dismiss="alert">×</a>
data was saved
</div>
Im using the following alert and I want it to be toggle after 2 sec,how should I do that ?
<div class="alert alert-info">
<a href="#" class="close" data-dismiss="alert">×</a>
data was saved
</div>
Share
Improve this question
asked Jul 10, 2014 at 11:41
07_05_GuyT07_05_GuyT
2,88715 gold badges48 silver badges92 bronze badges
4
-
Have you tried
setTimeout()
? – RevanProdigalKnight Commented Jul 10, 2014 at 11:43 - @RevanProdigalKnight-how can you provide example? – 07_05_GuyT Commented Jul 10, 2014 at 11:44
-
1
Using jQuery:
setTimeout(function() {$('.alert.alert-info').toggle(); },2000);
– RevanProdigalKnight Commented Jul 10, 2014 at 11:46 - Did you use the default way for bootstrap to enable the alert? – ImAtWar Commented Jul 10, 2014 at 11:53
4 Answers
Reset to default 4$('#alert').fadeIn('slow').delay(2000).fadeOut('slow');
JSBin Example
You can do that with setTimeout like:
setTimeout(function() {
// Do something after 2 seconds
$('.alert').show();
}, 2000);
The .alert
should be display:none;
by default.
use a setTimeout
:
setTimeout(function() {
$('.alert-info').hide();
}, 2000);
see demo -> http://jsfiddle/JAFmx/
For the default way, as is described on their website:
http://getbootstrap./javascript/
setTimeout(function() {
$(".alert").alert('close')
}, 2000);
Im using the following alert and I want it to be toggle after 2 sec,how should I do that ?
<div class="alert alert-info">
<a href="#" class="close" data-dismiss="alert">×</a>
data was saved
</div>
Im using the following alert and I want it to be toggle after 2 sec,how should I do that ?
<div class="alert alert-info">
<a href="#" class="close" data-dismiss="alert">×</a>
data was saved
</div>
Share
Improve this question
asked Jul 10, 2014 at 11:41
07_05_GuyT07_05_GuyT
2,88715 gold badges48 silver badges92 bronze badges
4
-
Have you tried
setTimeout()
? – RevanProdigalKnight Commented Jul 10, 2014 at 11:43 - @RevanProdigalKnight-how can you provide example? – 07_05_GuyT Commented Jul 10, 2014 at 11:44
-
1
Using jQuery:
setTimeout(function() {$('.alert.alert-info').toggle(); },2000);
– RevanProdigalKnight Commented Jul 10, 2014 at 11:46 - Did you use the default way for bootstrap to enable the alert? – ImAtWar Commented Jul 10, 2014 at 11:53
4 Answers
Reset to default 4$('#alert').fadeIn('slow').delay(2000).fadeOut('slow');
JSBin Example
You can do that with setTimeout like:
setTimeout(function() {
// Do something after 2 seconds
$('.alert').show();
}, 2000);
The .alert
should be display:none;
by default.
use a setTimeout
:
setTimeout(function() {
$('.alert-info').hide();
}, 2000);
see demo -> http://jsfiddle/JAFmx/
For the default way, as is described on their website:
http://getbootstrap./javascript/
setTimeout(function() {
$(".alert").alert('close')
}, 2000);
本文标签: javascriptToggle alert from bootstrapStack Overflow
版权声明:本文标题:javascript - Toggle alert from bootstrap - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745645884a2161022.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论