質問編集履歴

2

HTML追記しました。

2019/12/04 13:02

投稿

tetoro
tetoro

スコア16

test CHANGED
File without changes
test CHANGED
@@ -8,17 +8,33 @@
8
8
 
9
9
  <section class="elm">
10
10
 
11
- </section>
11
+ <div class="overlay"></div>
12
12
 
13
- <section class="elm">
13
+ <div class="titleLine"></div>
14
14
 
15
15
  </section>
16
16
 
17
17
  <section class="elm">
18
18
 
19
+ <div class="overlay"></div>
20
+
21
+ <div class="titleLine"></div>
22
+
19
23
  </section>
20
24
 
21
25
  <section class="elm">
26
+
27
+ <div class="overlay"></div>
28
+
29
+ <div class="titleLine"></div>
30
+
31
+ </section>
32
+
33
+ <section class="elm">
34
+
35
+ <div class="overlay"></div>
36
+
37
+ <div class="titleLine"></div>
22
38
 
23
39
  </section>
24
40
 

1

juqery変数追記、CSS追記しました。

2019/12/04 13:02

投稿

tetoro
tetoro

スコア16

test CHANGED
File without changes
test CHANGED
@@ -26,6 +26,38 @@
26
26
 
27
27
  ```
28
28
 
29
+ ```CSS
30
+
31
+ .overlay{
32
+
33
+ opacity: 0;
34
+
35
+ transition: 1.5s;
36
+
37
+ }
38
+
39
+ .overlay.fadeOn{
40
+
41
+ opacity: 1;
42
+
43
+ }
44
+
45
+ .titleLine{
46
+
47
+ opacity: 0;
48
+
49
+ }
50
+
51
+ .titleLine.fadeOn{
52
+
53
+ opacity: 1;
54
+
55
+ }
56
+
57
+ ```
58
+
59
+
60
+
29
61
  ```jquery
30
62
 
31
63
  $(window).on('scroll',function (){
@@ -40,11 +72,13 @@
40
72
 
41
73
  var elmPos = $(this).offset().top;
42
74
 
43
- console.log(elmPos);
75
+ if (scroll > elmPos - windowHeight + windowHeight/3){
44
76
 
45
77
 
46
78
 
79
+ var elmWhatOverlay = $('.overlay');
80
+
47
- if (scroll > elmPos - windowHeight + windowHeight/3){
81
+ var elmWhatTitleLine = $('.titleLine');
48
82
 
49
83
 
50
84