質問編集履歴

1

コードとテストサイトを追記

2022/08/06 03:47

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -17,3 +17,229 @@
17
17
 
18
18
 
19
19
 
20
+
21
+ 全部のコードを乗せると、長くなるため、抜粋しております。
22
+ 具体的にを文面で伝えると、難しいため、
23
+ https://xs442579.xsrv.jp/test/recruit/
24
+ テスト環境にアップしております。
25
+
26
+ 右上のページ内リンクを押すと、下にスクロールはできるが、上には、戻れない?感じです。
27
+
28
+ いやいや、position: sticky; を使用しているからだろ!
29
+ に関しましては、事前に概要に書いておりますので、その点はを踏まえて、見てくださませ。
30
+
31
+
32
+
33
+ ```HTML
34
+
35
+ ``` <ul class="toc">
36
+ <li class="toc__item">
37
+ <a class="toc__link" href="#split00">
38
+ <img src="<?php echo esc_url(get_theme_file_uri('img/recruit/icon_home.svg')); ?>" alt="HOME">
39
+ </a>
40
+ </li>
41
+ <li class="toc__item">
42
+ <a class="toc__link" href="#split01">01</a>
43
+ </li>
44
+ <li class="toc__item">
45
+ <a class="toc__link" href="#split02">02</a>
46
+ </li>
47
+ <li class="toc__item">
48
+ <a class="toc__link" href="#split03">03</a>
49
+ </li>
50
+ <li class="toc__item">
51
+ <a class="toc__link" href="#split04">04</a>
52
+ </li>
53
+ <li class="toc__item">
54
+ <a class="toc__link" href="#split05">05</a>
55
+ </li>
56
+ </ul>
57
+
58
+ <!-- <div class="prev">
59
+ <img src="<?php echo esc_url(get_theme_file_uri('img/recruit/icon_prev.svg')); ?>" alt="">
60
+ </div>
61
+
62
+ <div class="next">
63
+ <img src="<?php echo esc_url(get_theme_file_uri('img/recruit/icon_next.svg')); ?>" alt="HOME">
64
+ </div> -->
65
+
66
+ <div id="luxy" class="split">
67
+
68
+ <!-- <div id="split01" class="block block-one">
69
+ <p class="block__text">One</p>
70
+ </div>
71
+ <div id="split02" class="block block-two">
72
+ <p class="block__text">Two</p>
73
+ </div>
74
+ <div id="split03" class="block block-three">
75
+ <p class="block__text">Three</p>
76
+ </div>
77
+ <div id="split04" class="block block-four">
78
+ <p class="block__text">Four</p>
79
+ </div>
80
+ <div id="split05" class="block block-five">
81
+ <p class="block__text">Five</p>
82
+ </div> -->
83
+
84
+
85
+ <div id="split00" class="block block-home">
86
+ <p class="block__text">Home</p>
87
+ </div>
88
+ <div id="split01" class="block block-one">
89
+ <p class="block__text">One</p>
90
+ </div>
91
+ <div id="split02" class="block block-two">
92
+ <p class="block__text">Two</p>
93
+ </div>
94
+ <div id="split03" class="block block-three">
95
+ <p class="block__text">Three</p>
96
+ </div>
97
+ <div id="split04" class="block block-four">
98
+ <p class="block__text">Four</p>
99
+ </div>
100
+ <div id="split05" class="block block-five">
101
+ <p class="block__text">Five</p>
102
+ </div>
103
+ </div>
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ ```CSS
116
+ .toc {
117
+ position: fixed;
118
+ top: 30px;
119
+ right: 30px;
120
+ z-index: 100;
121
+ display: flex;
122
+ }
123
+
124
+ .toc__item {
125
+ display: flex;
126
+ width: 30px;
127
+ height: 30px;
128
+ border: 1px solid #707070;
129
+ border-radius: 50%;
130
+ background: #fff;
131
+ }
132
+
133
+ .toc__item:not(:first-child) {
134
+ font-weight: 700;
135
+ }
136
+
137
+ .toc__item:not(:last-child) {
138
+ margin-right: 20px;
139
+ }
140
+
141
+ .toc__link {
142
+ display: flex;
143
+ justify-content: center;
144
+ align-items: center;
145
+ width: 100%;
146
+ color: #30386C;
147
+ /*width: 30px;*/
148
+ }
149
+
150
+ .toc__item:first-child .toc__link img {
151
+ width: 14px;
152
+ }
153
+
154
+ .prev,
155
+ .next {
156
+ position: fixed;
157
+ left: 50%;
158
+ transform: translateX(-50%);
159
+ z-index: 100;
160
+ width: 40px;
161
+ }
162
+
163
+ .prev {
164
+ top: 30px;
165
+ }
166
+
167
+ .next {
168
+ bottom: 30px;
169
+ }
170
+
171
+
172
+
173
+
174
+ .block {
175
+ /* スクロールスナップ */
176
+ /*scroll-snap-align: start;*/
177
+ height: 100vh;
178
+
179
+
180
+ display: flex;
181
+ justify-content: center;
182
+ align-items: center;
183
+ width: 100%;
184
+ position: -webkit-sticky;
185
+ position: sticky;
186
+ top: 0;
187
+ left: 0;
188
+ }
189
+
190
+ .block-home {
191
+ background: #f6bfbc;
192
+ }
193
+
194
+ .block-one {
195
+ background: #212E32;
196
+ color: #fff;
197
+ z-index: 10;
198
+ }
199
+
200
+ .block-two {
201
+ background: #85937A;
202
+ z-index: 20;
203
+ }
204
+
205
+ .block-three {
206
+ background: #d0af4c;
207
+ z-index: 30;
208
+ }
209
+
210
+ .block-four {
211
+ background: #4c6473;
212
+ z-index: 40;
213
+ }
214
+
215
+ .block-five {
216
+ background: #c37854;
217
+ z-index: 50;
218
+ }
219
+
220
+ .block__text {
221
+ font-size: 60px;
222
+ font-family: 'Great Vibes', cursive;
223
+ }```
224
+
225
+
226
+
227
+ ```jQuery
228
+ $(function(){
229
+
230
+ /*=================================================
231
+ スムーススクロール
232
+ =================================================*/
233
+ $('a[href^="#"]').click(function(){
234
+ let href= $(this).attr("href");
235
+ let target = $(href == "#" || href == "" ? 'html' : href);
236
+ let position = target.offset().top;
237
+ $("html, body").animate({scrollTop:position}, 500, "swing");
238
+ return false;
239
+ });
240
+
241
+ });
242
+ ```
243
+
244
+
245
+