質問編集履歴

1

外部サービスなど使わずに質問場所にコードを掲載するように変更しました

2018/08/13 14:47

投稿

teta
teta

スコア16

test CHANGED
File without changes
test CHANGED
@@ -14,4 +14,114 @@
14
14
 
15
15
  どなたかいいやり方ご教授いただけると助かります。
16
16
 
17
+ ```html
18
+
19
+ <p class="text_animate">te<br>st</p>
20
+
21
+ ```
22
+
23
+
24
+
25
+ ```scss
26
+
27
+
28
+
29
+ .text_animate{
30
+
31
+ span{
32
+
33
+ transition: 1s;
34
+
35
+ opacity: 0;
36
+
37
+ &.text_animate_on{
38
+
39
+ transition: 1s;
40
+
41
+ opacity: 1;
42
+
43
+
44
+
45
+ }
46
+
47
+ }
48
+
49
+ &.text_animate_rotate span{
50
+
51
+ transform: rotate(-45deg);
52
+
53
+ display: inline-block;
54
+
55
+ &.text_animate_rotate_on{
56
+
57
+ transform: rotate(0deg);
58
+
59
+ }
60
+
61
+ }
62
+
63
+ &.text_animate_size span{
64
+
65
+ font-size: 22px;
66
+
67
+ &.text_animate_size_on{
68
+
69
+ font-size: 10px;
70
+
71
+ }
72
+
73
+ }
74
+
75
+ }
76
+
77
+ ```
78
+
79
+ ```javascript
80
+
81
+ $(function(){
82
+
83
+ var text=$(".text_animate").html();
84
+
17
- https://codepen.io/eqnu7zplnsaq9gl/pen/PBLpPm
85
+ /*var html_tags = /</?[^>]+>/;
86
+
87
+ var text_split=text.split(html_tags);*/
88
+
89
+ var text_split=text.split("");
90
+
91
+ $(".text_animate").html("");
92
+
93
+ function animate(){
94
+
95
+ text_split.forEach(function(val){
96
+
97
+ /*console.log(val);*/
98
+
99
+
100
+
101
+
102
+
103
+ $(".text_animate").append("<span>"+val+"</span>");
104
+
105
+
106
+
107
+ });
108
+
109
+
110
+
111
+ }
112
+
113
+ animate();
114
+
115
+ $(window).load(function(){
116
+
117
+ $(".text_animate span").each(function(index){
118
+
119
+ $(this).css({transitionDelay:index * 0.6 +"s"}).addClass("text_animate_on");
120
+
121
+ });
122
+
123
+ });
124
+
125
+ });
126
+
127
+ ```