-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathexample.html
51 lines (42 loc) · 1.15 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!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>