-
Notifications
You must be signed in to change notification settings - Fork 0
/
transition-over-out.html
89 lines (80 loc) · 2.85 KB
/
transition-over-out.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Transition on display: block/none</title>
<meta name="description" content="Transitions made on element which must use display: block/none">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Piotr Szczęśniak">
<style>
body {
font-family: Arial;
}
.element {
width: 300px;
height: 300px;
background-color: green;
animation-delay: 0s;
animation-duration: 1s;
animation-fill-mode: forwards;
animation-iteration-count: 1;
animation-name:test-animation-out;
animation-timing-function: ease-out;
}
.link:hover + .element {
animation-delay: 0s;
animation-duration: 1s;
animation-fill-mode: forwards;
animation-iteration-count: 1;
animation-name:test-animation-over;
animation-timing-function: ease-out;
position: absolute;
}
@keyframes test-animation-out {
0% {
display: none;
opacity: 0;
visibility: hidden;
}
1% {
display: block;
opacity: 0;
visibility: hidden;
transform: translateY(50vh);
}
100% {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
}
@keyframes test-animation-over {
0% {
display: block;
opacity: 1;
visibility: visible;
transform: translateY(0);
}
99% {
display: block;
opacity: 0;
visibility: hidden;
transform: translateY(50vh);
}
100% {
display: none;
opacity: 0;
visibility: hidden;
transform: translateY(50vh);
}
}
</style>
</head>
<body>
<h1>Transitions using disply:block/none</h1>
<a class="link" title="Hover me" href="#">Hover me</a>
<div class="element"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</body>
</html>