質問編集履歴
2
試したことについて追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,15 +4,23 @@
|
|
4
4
|
|
5
5
|
スマートフォンで表示するサイトに動きを加えたいと思っています。
|
6
6
|
|
7
|
-
|
7
|
+
クリックした画像が上に移動してそこで違う画像に変化するというものです。
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
Animate.css(https://daneden.github.io/animate.css/)
|
11
|
+
Animate.css(https://daneden.github.io/animate.css/)で試していますが
|
12
12
|
|
13
13
|
画像が上にすーっと移動して、その場所で別の画像に切り替わるのではなく
|
14
14
|
|
15
|
-
元の画像の場所で切り替わってしま
|
15
|
+
元の画像の場所で切り替わってしまいます。
|
16
|
+
|
17
|
+
「animation-fill-mode: forwards」を指定しましたが利かないようです。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
下記のcssにプラスしてanimate.cssとjqueryを読みこんでいます。
|
22
|
+
|
23
|
+
全文は重くて貼れないので修正箇所のみ記載しています。
|
16
24
|
|
17
25
|
|
18
26
|
|
@@ -52,9 +60,121 @@
|
|
52
60
|
|
53
61
|
```
|
54
62
|
|
55
|
-
|
63
|
+
```css
|
56
64
|
|
65
|
+
/* (animate.cssから、修正を入れた場所のみ抜粋) */
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
@-webkit-keyframes zoomOutUp {
|
70
|
+
|
71
|
+
40% {
|
72
|
+
|
73
|
+
opacity: 1;
|
74
|
+
|
75
|
+
-webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);
|
76
|
+
|
77
|
+
transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);
|
78
|
+
|
79
|
+
-webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
80
|
+
|
81
|
+
animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
to {
|
88
|
+
|
89
|
+
opacity: 0;
|
90
|
+
|
91
|
+
-webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);
|
92
|
+
|
93
|
+
transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);
|
94
|
+
|
95
|
+
-webkit-transform-origin: center bottom;
|
96
|
+
|
97
|
+
transform-origin: center bottom;
|
98
|
+
|
99
|
+
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);
|
100
|
+
|
101
|
+
animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
@keyframes zoomOutUp {
|
110
|
+
|
111
|
+
40% {
|
112
|
+
|
113
|
+
opacity: 1;
|
114
|
+
|
115
|
+
-webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);
|
116
|
+
|
117
|
+
transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0);
|
118
|
+
|
119
|
+
-webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
120
|
+
|
121
|
+
animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
to {
|
128
|
+
|
129
|
+
opacity: 0;
|
130
|
+
|
131
|
+
-webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);
|
132
|
+
|
133
|
+
transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0);
|
134
|
+
|
135
|
+
-webkit-transform-origin: center bottom;
|
136
|
+
|
137
|
+
transform-origin: center bottom;
|
138
|
+
|
139
|
+
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);
|
140
|
+
|
141
|
+
animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1);
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
|
57
|
-
|
149
|
+
.zoomOutUp {
|
150
|
+
|
151
|
+
-webkit-animation-name: zoomOutUp;
|
152
|
+
|
153
|
+
animation-name: zoomOutUp;
|
154
|
+
|
155
|
+
-webkit-animation-fill-mode: forwards !important;
|
156
|
+
|
157
|
+
animation-fill-mode: forwards !important;
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
.animated {
|
164
|
+
|
165
|
+
-webkit-animation-duration: 1s;
|
166
|
+
|
167
|
+
animation-duration: 1s;
|
168
|
+
|
169
|
+
-webkit-animation-fill-mode: forwards !important;
|
170
|
+
|
171
|
+
animation-fill-mode: forwards !important;
|
172
|
+
|
173
|
+
}
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
```
|
58
178
|
|
59
179
|
|
60
180
|
|
@@ -64,6 +184,8 @@
|
|
64
184
|
|
65
185
|
教えていただいて、元の画像を別の画像に切り替えるところまではできました。
|
66
186
|
|
187
|
+
animate.cssにanimation-fill-modeを設定しました。
|
188
|
+
|
67
189
|
|
68
190
|
|
69
191
|
### 補足情報(FW/ツールのバージョンなど)
|
1
やってみたことを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,22 +4,70 @@
|
|
4
4
|
|
5
5
|
スマートフォンで表示するサイトに動きを加えたいと思っています。
|
6
6
|
|
7
|
-
考えているのは、クリックした画像が上に移動して
|
7
|
+
考えているのは、クリックした画像が上に移動してそこで違う画像に変化するというものです。
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
(
|
11
|
+
Animate.css(https://daneden.github.io/animate.css/)を使用してやってみたのですが
|
12
12
|
|
13
|
-
|
13
|
+
画像が上にすーっと移動して、その場所で別の画像に切り替わるのではなく
|
14
|
+
|
15
|
+
元の画像の場所で切り替わってしまうのでなおすことはできますか?
|
14
16
|
|
15
17
|
|
16
18
|
|
17
|
-
|
19
|
+
### 該当のソースコード
|
18
20
|
|
19
|
-
参考になるものをいくつか見つけたのですが
|
20
21
|
|
21
|
-
(https://daneden.github.io/animate.css/ ここの【slideOutUp】など)
|
22
22
|
|
23
|
-
|
23
|
+
```HTML
|
24
24
|
|
25
|
+
<img class="ani-logo" src="https://placehold.jp/150x150.png" alt="" />
|
26
|
+
|
27
|
+
```
|
28
|
+
|
29
|
+
```javaScript
|
30
|
+
|
31
|
+
$(function(){
|
32
|
+
|
33
|
+
$(".ani-logo").on({
|
34
|
+
|
35
|
+
"click":function(){
|
36
|
+
|
37
|
+
$(this).addClass("animated zoomOutUp");
|
38
|
+
|
39
|
+
},
|
40
|
+
|
41
|
+
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend":function(){
|
42
|
+
|
43
|
+
$(this).removeClass("animated zoomOutUp");
|
44
|
+
|
45
|
+
$(this).attr("src", "http://placehold.jp/24/cc9999/993333/150x100.png");
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
});
|
50
|
+
|
51
|
+
});
|
52
|
+
|
53
|
+
```
|
54
|
+
|
55
|
+
これにanimate.css(https://daneden.github.io/animate.css/)とjqueryを読みこんでいます。
|
56
|
+
|
25
|
-
|
57
|
+
(重くなるので貼れませんでした)
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
### 試したこと
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
教えていただいて、元の画像を別の画像に切り替えるところまではできました。
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
### 補足情報(FW/ツールのバージョンなど)
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
ここにより詳細な情報を記載してください。
|