質問編集履歴

2

HTMLとCSSを追加

2020/04/15 00:48

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
 
46
46
 
47
- ```ここに言語名を入力
47
+ ```Java script
48
48
 
49
49
  $(function() {
50
50
 
@@ -90,6 +90,158 @@
90
90
 
91
91
 
92
92
 
93
+ ```HTML
94
+
95
+ <header>
96
+
97
+ <nav class="g-nav">
98
+
99
+ <ul class="g-nav-menu">
100
+
101
+ <li>HOME</li>
102
+
103
+ <li>ABOUT</li>
104
+
105
+ <li>CONTCT</li>
106
+
107
+ </ul>
108
+
109
+ </nav>
110
+
111
+ </header>
112
+
113
+
114
+
115
+ <section id="sec01">
116
+
117
+ <p>コンテンツ1</p>
118
+
119
+ </section>
120
+
121
+
122
+
123
+ <section id="sec02">
124
+
125
+ <p>コンテンツ2</p>
126
+
127
+ </section>
128
+
129
+
130
+
131
+ <section id="sec03">
132
+
133
+ <p>コンテンツ3</p>
134
+
135
+ </section>
136
+
137
+
138
+
139
+ ```
140
+
141
+
142
+
143
+ ```CSS
144
+
145
+ header{
146
+
147
+ background: #155263;
148
+
149
+ position: relative;
150
+
151
+ width: 100%;
152
+
153
+ }
154
+
155
+ .g-nav{
156
+
157
+ width: 100%;
158
+
159
+ z-index: 10;
160
+
161
+ }
162
+
163
+ .g-nav-menu{
164
+
165
+ text-align: center;
166
+
167
+ }
168
+
169
+ .g-nav-menu li{
170
+
171
+ color: #fff;
172
+
173
+ padding: 0 30px;
174
+
175
+ list-style-type: none;
176
+
177
+ display: inline-block;
178
+
179
+ line-height: 80px;
180
+
181
+ }
182
+
183
+ .fixed{
184
+
185
+ position: fixed;
186
+
187
+ top: 0;
188
+
189
+ left: 0;
190
+
191
+ }
192
+
193
+ .fixed .g-nav-menu li{
194
+
195
+ line-height: 40px;
196
+
197
+ }
198
+
199
+ section{
200
+
201
+ display: table;
202
+
203
+ width: 100%;
204
+
205
+ height: 800px;
206
+
207
+ text-align: center;
208
+
209
+ }
210
+
211
+ section p{
212
+
213
+ display: table-cell;
214
+
215
+ vertical-align: middle;
216
+
217
+ color: #fff;
218
+
219
+ }
220
+
221
+ #sec01{
222
+
223
+ background: #FF6F3C;
224
+
225
+ }
226
+
227
+ #sec02{
228
+
229
+ background: #FF9A3C;
230
+
231
+ }
232
+
233
+ #sec03{
234
+
235
+ background: #FFC93C;
236
+
237
+ }
238
+
239
+
240
+
241
+ ```
242
+
243
+
244
+
93
245
  ### 試したこと
94
246
 
95
247
 

1

該当のソースコードを修正しました。

2020/04/15 00:48

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -72,9 +72,9 @@
72
72
 
73
73
  }
74
74
 
75
- //現在の位置が300px以下かつ、クラスfixedが付与されている時にfixedを外す
75
+ //現在の位置が500px以下かつ、クラスfixedが付与されている時にfixedを外す
76
76
 
77
- else if($(this).scrollTop() < 300 && headNav.hasClass('fixed') == true){
77
+ else if($(this).scrollTop() < 500 && headNav.hasClass('fixed') == true){
78
78
 
79
79
  headNav.removeClass('fixed');
80
80