Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (42 sloc) 1.15 KB
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="preparetransition.js"></script>
<style>
.msg {
position: absolute;
padding: 5px 10px;
border-radius: 10px;
background-color: #CCC;
-webkit-transition: opacity 1s;
-moz-transition: opacity 1s;
-ms-transition: opacity 1s;
-o-transition: opacity 1s;
opacity: 1;
}
#msg1 { top:50px; }
#msg2 { top:80px; }
.msg.hidden {
display:none;
opacity: 0;
}
.is-transitioning {
display: block !important;
visibility: visible !important;
}
</style>
</head>
<body>
<button id="btn-test">Toggle message</button>
<div id="msg1" class="msg">Here is a message that needs to be displayed 1</div>
<div id="msg2" class="msg hidden">Here is a message that needs to be displayed 2</div>
<script>
$('#btn-test').bind('click', function(){
$('.msg').prepareTransition().toggleClass('hidden');
});
</script>
</body>
</html>