Created
April 7, 2015 09:14
-
-
Save pixelkritzel/83327c9be1ee43e6d21b to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/rarugo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery.min.js"></script> | |
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.fade-out { | |
opacity: 0; | |
transition: all 2s ease; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="alert alert-warning alert-dismissible" role="alert"> | |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<strong>Warning!</strong> Better check yourself, you're not looking too good. | |
</div> | |
<script id="jsbin-javascript"> | |
$('.close').click(fadeOut); | |
$(document).on('transitionend', '.fade-out', removeFadedElement) | |
function fadeOut(event) { | |
$(event.target).closest('.alert').addClass('fade-out'); | |
} | |
function removeFadedElement(event) { | |
$(event.target).remove(); | |
} | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery.min.js"><\/script> | |
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div class="alert alert-warning alert-dismissible" role="alert"> | |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<strong>Warning!</strong> Better check yourself, you're not looking too good. | |
</div> | |
</body> | |
</html></script> | |
<script id="jsbin-source-css" type="text/css">.fade-out { | |
opacity: 0; | |
transition: all 2s ease; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript">$('.close').click(fadeOut); | |
$(document).on('transitionend', '.fade-out', removeFadedElement) | |
function fadeOut(event) { | |
$(event.target).closest('.alert').addClass('fade-out'); | |
} | |
function removeFadedElement(event) { | |
$(event.target).remove(); | |
}</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.fade-out { | |
opacity: 0; | |
transition: all 2s ease; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.close').click(fadeOut); | |
$(document).on('transitionend', '.fade-out', removeFadedElement) | |
function fadeOut(event) { | |
$(event.target).closest('.alert').addClass('fade-out'); | |
} | |
function removeFadedElement(event) { | |
$(event.target).remove(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment