Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Alerta auto-fechável"
Bootstrap 3.1.0 Snippet by
imatheusmoreira
3.1.0
jQuery
alert
Preview
HTML
JS
View Full Screen
Forked from
Fork
Fork this
Parent
764
 
0 Fav
Post to Facebook
Tweet this
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container" style="height: 600px;"> <div class="row"> <h2>Click buttons to test alert messages</h2> <br /> <div class="col-md-3"> <!-- Success buttons messages --> <button id="autoclosable-btn-success" class="btn btn-primary btn-success btn-block"> Autocloseable message success </button> <button id="normal-btn-success" class="btn btn-primary btn-success btn-block"> Normal message success </button> <!-- Warning buttons messages --> <button id="autoclosable-btn-warning" class="btn btn-primary btn-warning btn-block"> Autocloseable message warning </button> <button id="normal-btn-warning" class="btn btn-primary btn-warning btn-block"> Normal message warning </button> <!-- Danger buttons messages --> <button id="autoclosable-btn-danger" class="btn btn-primary btn-danger btn-block"> Autocloseable message danger </button> <button id="normal-btn-danger" class="btn btn-primary btn-danger btn-block"> Normal message danger </button> <!-- Info buttons messages --> <button id="autoclosable-btn-info" class="btn btn-primary btn-info btn-block"> Autocloseable message info </button> <button id="normal-btn-info" class="btn btn-primary btn-info btn-block"> Normal message info </button> </div> <div class="col-md-9"> <!-- Success messages --> <div class="alert alert-success alert-autocloseable-success"> I'm an autocloseable success message. I will hide in 5 seconds. </div> <div class="alert alert-success alert-normal-success" hidden="hidden"> <button type="button" class="close">×</button> I'm a normal success message. To close use the appropriate button. </div> <!-- Warning messages --> <div class="alert alert-warning alert-autocloseable-warning"> I'm an autocloseable warning message. I will hide in 3 seconds. </div> <div class="alert alert-warning alert-normal-warning" hidden="hidden"> <button type="button" class="close">×</button> I'm a normal warning message. To close use the appropriate button. </div> <!-- Danger messages --> <div class="alert alert-danger alert-autocloseable-danger"> I'm an autocloseable danger message. I will hide in 5 seconds. </div> <div class="alert alert-danger alert-normal-danger" hidden="hidden"> <button type="button" class="close">×</button> I'm a normal danger message. To close use the appropriate button. </div> <!-- Info messages --> <div class="alert alert-info alert-autocloseable-info"> I'm an autocloseable info message. I will hide in 6 seconds. </div> <div class="alert alert-info alert-normal-info" hidden="hidden"> <button type="button" class="close">×</button> I'm a normal info message. To close use the appropriate button. </div> </div> </div> </div>
$(document).ready(function () { $('.alert-autocloseable-success').hide(); $('.alert-autocloseable-warning').hide(); $('.alert-autocloseable-danger').hide(); $('.alert-autocloseable-info').hide(); $('#autoclosable-btn-success').click(function() { $('#autoclosable-btn-success').prop("disabled", true); $('.alert-autocloseable-success').show(); $('.alert-autocloseable-success').delay(5000).fadeOut( "slow", function() { // Animation complete. $('#autoclosable-btn-success').prop("disabled", false); }); }); $('#normal-btn-success').click(function() { $('.alert-normal-success').show(); }); $('#autoclosable-btn-warning').click(function() { $('#autoclosable-btn-warning').prop("disabled", true); $('.alert-autocloseable-warning').show(); $('.alert-autocloseable-warning').delay(3000).fadeOut( "slow", function() { // Animation complete. $('#autoclosable-btn-warning').prop("disabled", false); }); }); $('#normal-btn-warning').click(function() { $('.alert-normal-warning').show(); }); $('#autoclosable-btn-danger').click(function() { $('#autoclosable-btn-danger').prop("disabled", true); $('.alert-autocloseable-danger').show(); $('.alert-autocloseable-danger').delay(5000).fadeOut( "slow", function() { // Animation complete. $('#autoclosable-btn-danger').prop("disabled", false); }); }); $('#normal-btn-danger').click(function() { $('.alert-normal-danger').show(); }); $('#autoclosable-btn-info').click(function() { $('#autoclosable-btn-info').prop("disabled", true); $('.alert-autocloseable-info').show(); $('.alert-autocloseable-info').delay(6000).fadeOut( "slow", function() { // Animation complete. $('#autoclosable-btn-info').prop("disabled", false); }); }); $('#normal-btn-info').click(function() { $('.alert-normal-info').show(); }); $(document).on('click', '.close', function () { $(this).parent().hide(); }); });
Related:
See More
Free Template
Material Kit React
50.3K
5
Navbar Search Box Auto Expand
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76