-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.html
More file actions
518 lines (470 loc) · 23.6 KB
/
main.html
File metadata and controls
518 lines (470 loc) · 23.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<script src="foodData.js"></script>
<title>잔쿡 메인</title>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script>
$(document).ready(function () {
window.toggleSub = function (id) {
$('.subcategory').hide();
$('#' + id).show();
};
$(document).ready(function () {
$('.menu-toggle').click(function () {
$('#mobileMenu').toggleClass('show');
});
});
});
function toggleSub(id) {
const subs = document.querySelectorAll('.subcategory');
subs.forEach(sub => sub.style.display = 'none');
const target = document.getElementById(id);
if (target) {
target.style.display = 'block';
}
}
function filterRecipes() {
const selected = Array.from(document.querySelectorAll('.subcategory input:checked'))
.map(input => input.parentElement.textContent.trim());
const resultBox = document.getElementById("search-result");
const placeholder = document.getElementById("ingredient-placeholder");
resultBox.innerHTML = "";
if (selected.length === 0) {
placeholder.style.display = "block";
return;
} else {
placeholder.style.display = "none";
}
const matched = foodData.filter(food =>
selected.every(sel => food.ingredients.includes(sel))
);
if (matched.length === 0) {
resultBox.innerHTML = "<div class='no-result'>조건에 맞는 음식이 없습니다.</div>";
return;
}
matched.forEach(food => {
const div = document.createElement("div");
div.className = "food-card";
div.innerHTML = `
<a href="${food.link}">
<img src="${food.img}" alt="${food.name}">
<p>${food.name}</p>
</a>`;
resultBox.appendChild(div);
});
}
window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.subcategory input[type=checkbox]').forEach(chk => {
chk.addEventListener('change', filterRecipes);
});
});
document.addEventListener('DOMContentLoaded', function () {
const categoryItems = document.querySelectorAll('.category-item');
categoryItems.forEach(item => {
item.addEventListener('mouseenter', function () {
this.classList.add('active');
});
item.addEventListener('mouseleave', function () {
this.classList.remove('active');
});
});
let currentIndex = 0;
const slides = document.querySelectorAll('.slider-slide');
const dots = document.querySelectorAll('.slider-nav button');
const totalSlides = slides.length;
function showSlide(index) {
const newTransformValue = -index * 100;
document.querySelector('.slider-wrapper').style.transform = `translateX(${newTransformValue}%)`;
dots.forEach(dot => dot.classList.remove('active'));
dots[index].classList.add('active');
}
function nextSlide() {
currentIndex = (currentIndex + 1) % totalSlides;
showSlide(currentIndex);
}
dots.forEach((dot, index) => {
dot.addEventListener('click', () => showSlide(index));
});
setInterval(nextSlide, 3000);
showSlide(currentIndex);
});
</script>
</head>
<body>
<div class="container">
<header>
<div class="logo">
<a href="main.html"><img class="logo-image" src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
Logo.png" alt="잔쿡"></a>
</div>
<div class="search-box">
<input type="text" placeholder="재료를 넣어주세요..." />
</div>
<div class="icons">
<a href="/signup" title="회원가입"><img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
014-add.png" alt="회원가입"></a>
<a href="/login" title="로그인"><img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
015-user-1.png" alt="로그인"></a>
</div>
<div class="div-mobile-toggle">
<button class="menu-toggle">☰</button>
</div>
<div class="mobile-menu" id="mobileMenu">
<a href="/login">로그인</a>
<a href="/signup">회원가입</a>
<a href="#">종류별 음식</a>
<a href="ingredients.html">재료로 검색</a>
<a href="#">초보용 음식</a>
<a href="cookingTime.html">조리 시간별</a>
</div>
</header>
<nav>
<ul class="nav-menu">
<li><a href="#">종류별 음식</a></li>
<li><a href="ingredients.html">재료로 검색</a></li>
<li><a href="#">초보용 음식</a></li>
<li><a href="cookingTime.html">조리 시간별</a></li>
</ul>
</nav>
<section class="slider-container">
<div class="slider-wrapper">
<div class="slider-slide">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
ad1.png" alt="Advertisement 1">
</div>
<div class="slider-slide">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
ad2.png" alt="Advertisement 2">
</div>
<div class="slider-slide">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
ad3.png" alt="Advertisement 3">
</div>
</div>
<div class="slider-nav">
<button></button>
<button></button>
<button></button>
</div>
</section>
<div class="category-box">
<div class="category-icons">
<button onclick="toggleSub('meat')" href="ingredients.html">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
002-beef.png" alt="소고기">
<span>소고기</span>
</button>
<button onclick="toggleSub('pork')">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
003-pork.png" alt="돼지고기">
<span>돼지고기</span>
</button>
<button onclick="toggleSub('chicken')">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
001-hen.png" alt="닭고기">
<span>닭고기</span>
</button>
<button onclick="toggleSub('veggie')">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
005-vegetable.png" alt="채소류">
<span>채소류</span>
</button>
<button onclick="toggleSub('seafood')">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
008-seafood.png" alt="해물류">
<span>해물류</span>
</button>
<button onclick="toggleSub('grain')">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
bread.png" alt="곡류">
<span>곡류</span>
</button>
<button onclick="toggleSub('dairy')">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
010-dairy-products.png" alt="유제품">
<span>유제품</span>
</button>
<button onclick="toggleSub('mushroom')">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
006-mushrooms.png" alt="버섯류">
<span>버섯류</span>
</button>
<button onclick="toggleSub('etc')">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
007-seasoning.png" alt="기타">
<span>기타</span>
</button>
</div>
</div>
<div class="subcategory" id="meat">
<div class="subcategory-title">소고기 종류</div>
<label><input type="checkbox"> 소고기</label>
<label><input type="checkbox"> 등심</label>
<label><input type="checkbox"> 안심</label>
<label><input type="checkbox"> 갈비</label>
<label><input type="checkbox"> 차돌박이</label>
<label><input type="checkbox"> 사태</label>
<label><input type="checkbox"> 우둔살</label>
</div>
<div class="subcategory" id="pork">
<div class="subcategory-title">돼지고기 종류</div>
<label><input type="checkbox"> 돼지고기</label>
<label><input type="checkbox"> 삼겹살</label>
<label><input type="checkbox"> 목살</label>
<label><input type="checkbox"> 앞다리살</label>
<label><input type="checkbox"> 갈비살</label>
<label><input type="checkbox"> 항정살</label>
<label><input type="checkbox"> 가브리살</label>
</div>
<div class="subcategory" id="chicken">
<div class="subcategory-title">닭고기 종류</div>
<label><input type="checkbox"> 닭고기</label>
<label><input type="checkbox"> 닭가슴살</label>
<label><input type="checkbox"> 닭다리살</label>
<label><input type="checkbox"> 통닭</label>
<label><input type="checkbox"> 닭날개</label>
<label><input type="checkbox"> 닭근위</label>
</div>
<div class="subcategory" id="veggie">
<div class="subcategory-title">채소류</div>
<label><input type="checkbox"> 당근</label>
<label><input type="checkbox"> 토마토</label>
<label><input type="checkbox"> 옥수수</label>
<label><input type="checkbox"> 브로콜리</label>
<label><input type="checkbox"> 오이</label>
<label><input type="checkbox"> 양파</label>
<label><input type="checkbox"> 파프리카</label>
<label><input type="checkbox"> 대파</label>
<label><input type="checkbox"> 시금치</label>
<label><input type="checkbox"> 호박</label>
<label><input type="checkbox"> 감자</label>
<label><input type="checkbox"> 고구마</label>
<label><input type="checkbox"> 가지</label>
<label><input type="checkbox"> 마늘</label>
<label><input type="checkbox"> 배추</label>
<label><input type="checkbox"> 애호박</label>
</div>
<div class="subcategory" id="seafood">
<div class="subcategory-title">해물류</div>
<label><input type="checkbox"> 고등어</label>
<label><input type="checkbox"> 굴비</label>
<label><input type="checkbox"> 장어</label>
<label><input type="checkbox"> 연어</label>
<label><input type="checkbox"> 오징어</label>
<label><input type="checkbox"> 새우</label>
<label><input type="checkbox"> 홍합</label>
<label><input type="checkbox"> 바지락</label>
<label><input type="checkbox"> 문어</label>
<label><input type="checkbox"> 게</label>
</div>
<div class="subcategory" id="dairy">
<div class="subcategory-title">유제품</div>
<label><input type="checkbox"> 우유</label>
<label><input type="checkbox"> 치즈</label>
<label><input type="checkbox"> 버터</label>
<label><input type="checkbox"> 생크림</label>
<label><input type="checkbox"> 요거트</label>
<label><input type="checkbox"> 계란</label>
</div>
<div class="subcategory" id="grain">
<div class="subcategory-title">곡류</div>
<label><input type="checkbox"> 밥</label>
<label><input type="checkbox"> 보리</label>
<label><input type="checkbox"> 귀리</label>
<label><input type="checkbox"> 현미</label>
<label><input type="checkbox"> 찹쌀</label>
<label><input type="checkbox"> 빵</label>
<label><input type="checkbox"> 면</label>
<label><input type="checkbox"> 우동면</label>
<label><input type="checkbox"> 스파게티면</label>
<label><input type="checkbox"> 라면사리</label>
<label><input type="checkbox"> 소면</label>
<label><input type="checkbox"> 냉면사리</label>
<label><input type="checkbox"> 두부</label>
</div>
<div class="subcategory" id="mushroom">
<div class="subcategory-title">버섯류</div>
<label><input type="checkbox"> 버섯</label>
<label><input type="checkbox"> 표고버섯</label>
<label><input type="checkbox"> 느타리버섯</label>
<label><input type="checkbox"> 새송이버섯</label>
<label><input type="checkbox"> 팽이버섯</label>
<label><input type="checkbox"> 양송이버섯</label>
</div>
<div class="subcategory" id="etc">
<div class="subcategory-title">기타 / 양념</div>
<label><input type="checkbox"> 김치</label>
<label><input type="checkbox"> 고추장</label>
<label><input type="checkbox"> 된장</label>
<label><input type="checkbox"> 간장</label>
<label><input type="checkbox"> 설탕</label>
<label><input type="checkbox"> 참기름</label>
<label><input type="checkbox"> 마늘</label>
<label><input type="checkbox"> 생강</label>
<label><input type="checkbox"> 소금</label>
<label><input type="checkbox"> 식초</label>
<label><input type="checkbox"> 후추</label>
<label><input type="checkbox"> 고춧가루</label>
<label><input type="checkbox"> 식용유</label>
<label><input type="checkbox"> 참치캔</label>
<label><input type="checkbox"> 다진마늘</label>
<label><input type="checkbox"> 김</label>
</div>
<div class="recommendation-box">
<h2>검색 결과</h2>
<p id="ingredient-placeholder" style="color:gray; font-size:0.9rem; margin-top:0.5rem;">※ 재료를 골라주세요!</p>
<div id="search-result" class="search-result"></div>
<h2 class="recommendation-title">오늘의 추천메뉴</h2>
<main class="main-content">
<section class="recommendation-section">
<div class="food-grid">
<div class="food-card">
<a href="recipe.html">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
kimchi-rice.jpg" alt="음식1">
<p>김치볶음밥</p>
</a>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
steak.jpg"
alt="음식2">
<p>스테이크</p>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
sauteed-mushrooms-with-pumpkin-sweet-pepper.jpg" alt="음식3">
<p>호박버섯 볶음</p>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
soybean-soup.jpg" alt="음식4">
<p>매콤 된장찌개</p>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
pepper-paste-fork.jpg" alt="음식5">
<p>제육볶음</p>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
stir-fry-spaghetti-put-pork-bowl.jpg" alt="음식6">
<p>돼지고기 볶음 스파게티</p>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
front-view-fried-meat-with-vegetables-inside-plate-brown-wooden-desk-food-meal-meat.jpg"
alt="음식7">
<p>스테이크 샐러드</p>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
tasty-appetizing-classic-italian-spaghetti-pasta-with-tomato-sauce-cheese-parmesan-basil-plate-ingredients-cooking-pasta-white-marble-table.jpg"
alt="음식8">
<p>토마토 파스타</p>
</div>
<div class="food-card">
<a href="recipe.html">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
stir-fried-squid.png" alt="음식9">
<p>오징어 볶음</p>
</a>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
mas-issneun-chamchi-lesipi.jpg"
alt="음식10">
<p>참치마요덮밥</p>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
hangug-eumsig-gyelan-jjim-ttoneun-bansug-gyelan.jpg" alt="음식11">
<p>계란찜</p>
</div>
<div class="food-card">
<img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/food-image/
kimchi-stew.jpeg" alt="음식12">
<p>김치찌개</p>
</div>
</div>
</section>
</main>
</div>
<aside class="sidebar">
<aside class="ranking-box">
<h3>이번 주 인기메뉴</h3>
<div class="top-rank">
<div class="rank-item first">🥇 1등: 불고기</div>
<div class="rank-item second">🥈 2등: 김치찌개</div>
<div class="rank-item third">🥉 3등: 돈까스</div>
</div>
<ul class="rank-list">
<li>4등: 떡볶이</li>
<li>5등: 비빔밥</li>
<li>6등: 제육볶음</li>
<li>7등: 카레</li>
</ul>
</aside>
</aside>
</div>
<footer class="footer">
<div class="footer-container">
<div class="footer-top">
<div>
<h4>서비스</h4>
<ul>
<li>공지사항</li>
<li>자주 묻는 질문</li>
<li>계정 일시정지</li>
<li>고객센터</li>
</ul>
</div>
<div>
<h4>회사</h4>
<ul>
<li>회사 소개</li>
<li>채용</li>
<li>기술 블로그</li>
<li>블로그</li>
<li>광고</li>
</ul>
</div>
<div>
<h4>문의</h4>
<ul>
<li>광고 문의</li>
<li>인증 사업 문의</li>
<li>마케팅 · PR</li>
</ul>
</div>
<div>
<h4>고객센터</h4>
<ul>
<li>전화: 031-249- (24시간 연중무휴)</li>
<li>이메일(고객전용): support@jancook.com</li>
<li>민원 접수</li>
</ul>
</div>
</div>
<div class="footer-info">
<p><strong>(주)잔쿡</strong></p>
<p>사업자 등록번호: 104-98-01782 | 대표: 이동근</p>
<p>주소: 경기 수원시 영통구 광교산로 154-42</p>
<p>서비스 이용약관 | 개인정보 처리방침 | 마이데이터 서비스 이용약관</p>
</div>
<div class="footer-social">
<a href="#"><img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
001-facebook.png" alt="Facebook" /></a>
<a href="#"><img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
003-twitter.png" alt="Twitter" /></a>
<a href="#"><img src="https://raw.githubusercontent.com/JANCOOKWebProject/Web-Programming-Projectt/main/icon-image/
002-instagram.png" alt="Instagram" /></a>
</div>
</div>
</footer>
</body>
</html>