Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ 3주차 기본/심화/생각 과제 ] 🍚 점메추 🍚 #3

Open
wants to merge 111 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
dce3223
🎨 실습
hae2ni Oct 17, 2023
df5d69e
Merge branch 'week1' of https://github.com/DO-SOPT-WEB/HyeinKwon into…
hae2ni Oct 17, 2023
c1c28cc
🍱 data.js 추가
hae2ni Oct 17, 2023
5f4973f
🎨 index.js 추가
hae2ni Oct 17, 2023
fe862b1
✨ 1.a 이미지 호버시 어둡게 처리되며 제목 사진 나타남 구현
hae2ni Oct 17, 2023
7a89d46
💄 title, summary 꾸미기
hae2ni Oct 17, 2023
c90b73f
✨ 스크롤에 따라 투명도 다르게
hae2ni Oct 17, 2023
84b6da4
⚡️ 코드 깔끔하게 정리
hae2ni Oct 17, 2023
5d223ce
🍱 상수 데이터 추가
hae2ni Oct 19, 2023
22646ca
🎨 index.js 연결
hae2ni Oct 19, 2023
971f235
📝 주석 수정
hae2ni Oct 19, 2023
778df50
🔥 불필요 코드 삭제
hae2ni Oct 19, 2023
b91b555
🔥 불필요 코드 삭제
hae2ni Oct 19, 2023
e3b8eab
✨ 과제 2 1, 2 번 마무리
hae2ni Oct 19, 2023
df26c1e
🎨 chckbox checked 표시 지우기
hae2ni Oct 20, 2023
19e6012
🎨 3,4번 기본
hae2ni Oct 20, 2023
d7ce397
💄 hidden 요소 추가
hae2ni Oct 20, 2023
73dacb3
🎨 modal 일단 html에 박아놓기
hae2ni Oct 20, 2023
7e8630c
💄 modal 꾸미기
hae2ni Oct 20, 2023
8f3e1b1
🎨 modal radio 버튼으로 변경 id 추가
hae2ni Oct 21, 2023
e66a1c8
✨ 5번 a,b,c,e 구현
hae2ni Oct 21, 2023
03c93b8
💄 css 추가
hae2ni Oct 21, 2023
448be92
✨ 모달 금액 TOTAL 반영
hae2ni Oct 21, 2023
8239ecd
✨ 5.d 완료
hae2ni Oct 21, 2023
71f8e55
🎨 코드 줄 바꿈
hae2ni Oct 21, 2023
32dbb97
🍱 Data 추가
hae2ni Oct 24, 2023
bcdee23
💄 제목 설명 가운데 정렬
hae2ni Oct 24, 2023
86673a6
🎨 1번과제 심화 1번
hae2ni Oct 24, 2023
e6342ec
✨ preview 버튼 추가
hae2ni Oct 24, 2023
65a1171
🥅 심화 1번 자잘한 에러 제거
hae2ni Oct 25, 2023
61ba336
✨ 심화 2번 완료
hae2ni Oct 25, 2023
9d95a30
💄 모달 변경
hae2ni Oct 25, 2023
aa21ba7
✨ 심화 2.a
hae2ni Oct 25, 2023
b96648d
✨ 심화 b 금액이 아닌 숫자 입력시 alert
hae2ni Oct 25, 2023
8a2badf
✨ modal 뒷 배경 어둡게
hae2ni Oct 25, 2023
0ba969e
💄 심화 3.b 모달 아래에서 위로 올라오기
hae2ni Oct 25, 2023
3f7860f
✨ 심화 5번
hae2ni Oct 25, 2023
2016021
💄 모달 이쁘게 꾸미기
hae2ni Oct 25, 2023
fb51280
💄 삭제 모달 추가
hae2ni Oct 25, 2023
5b78f1d
💄 리스트 삭제 모달
hae2ni Oct 26, 2023
26b2f87
✨ 심화 1번 완료
hae2ni Oct 26, 2023
6a65a53
💄 카테고리 관리로 이동하는 버튼 추가
hae2ni Oct 26, 2023
f5ba2b8
💄 카테고리 페이지 꾸미기
hae2ni Oct 26, 2023
75718ac
💄 카테고리 페이지 꾸미기
hae2ni Oct 26, 2023
4a93378
✨ 심화 4번 2,3,4,6
hae2ni Oct 26, 2023
3eca375
✨ 심화 4번 완료
hae2ni Oct 26, 2023
15ebba8
♻️ 시멘틱 태그 추가
hae2ni Oct 26, 2023
784dd85
Merge branch 'main' of https://github.com/DO-SOPT-WEB/HyeinKwon into …
hae2ni Oct 26, 2023
86d78e9
📝 생각과제
hae2ni Oct 26, 2023
63b2840
🚑 오류 고침
hae2ni Oct 26, 2023
1013308
🚑 오류 수정
hae2ni Oct 26, 2023
48ad3b2
✨ begin project
hae2ni Nov 6, 2023
36e4e47
✨ 프로젝트 시작
hae2ni Nov 6, 2023
e726fac
💄 style 추가
hae2ni Nov 6, 2023
ff06cd3
💄 Header 추가
hae2ni Nov 6, 2023
23dd1f8
💄 theme, style 변경
hae2ni Nov 6, 2023
3cce131
✨ 게임판? 메인 추가
hae2ni Nov 6, 2023
c5e9cd6
✨ 랜덤 추천 버튼 추가
hae2ni Nov 6, 2023
0a52078
✨ 랜덤 추천 시작페이지 추가
hae2ni Nov 6, 2023
d5f4e55
✨ 랜덤 추천 시 카운트 다운 추가
hae2ni Nov 6, 2023
1b2810e
✨ 취향으로 추천 버튼 추가
hae2ni Nov 6, 2023
b31ab4b
✨ 취향으로 추천 시작 페이지 추가
hae2ni Nov 6, 2023
eff280b
✨ 메인 헤더 추가
hae2ni Nov 6, 2023
634244d
🍱 이미지 리스트 추가
hae2ni Nov 6, 2023
0638054
⚡️
hae2ni Nov 6, 2023
28a47fd
✨ 취향 추천 시작 페이지
hae2ni Nov 6, 2023
98f0e24
✨ 취향 추천 페이지
hae2ni Nov 6, 2023
6d8aae6
🔥
hae2ni Nov 6, 2023
2b29181
🍱 데이터 추가 및 변경
hae2ni Nov 7, 2023
7177fa5
✨ randompage에서 다시하기 버튼 추가
hae2ni Nov 7, 2023
8bd0e21
✨ randompage 결과 하면 추가
hae2ni Nov 7, 2023
697d7b5
✨ 랜덤 결과가 나오도록 설정
hae2ni Nov 7, 2023
c8b800e
🚑 다시하기 눌러도 화면이 바뀌지 않는 오류 수정
hae2ni Nov 7, 2023
49a37f8
✨ 카운트 다운 부분 props 넘겨주기
hae2ni Nov 7, 2023
ba8b4b5
✨ category 선택 화면 추가
hae2ni Nov 7, 2023
93f9853
✨ category 선택 화면 추가
hae2ni Nov 7, 2023
ac44b9b
🐛 eslint bug 설정
hae2ni Nov 8, 2023
1ba0322
✨ 다시하기 결과보기 등 버튼 컴포넌트 나눔
hae2ni Nov 8, 2023
90458c2
✨ 마지막 라운드 페이지 추가
hae2ni Nov 8, 2023
e8ed374
✨ 카테고리 페이지 추가
hae2ni Nov 8, 2023
11eee84
✨ 타입으로 추천받기 페이지 설정
hae2ni Nov 8, 2023
e63f5a4
🔥 쓸모 없는 파일 삭제
hae2ni Nov 8, 2023
ca87aee
💄 컴포넌트 나눈 부분으로 수정
hae2ni Nov 8, 2023
f2006e7
✨ 두번째 단계 페이지 추가
hae2ni Nov 8, 2023
5bdeb22
🔥 console 삭제
hae2ni Nov 8, 2023
26b4a1a
✨ 마지막 단계 화면 추가
hae2ni Nov 8, 2023
1b111d5
✨ 선택된 부분 state에 저장하도록 수정
hae2ni Nov 8, 2023
4ea0b2d
✨ 결과 화면 추가
hae2ni Nov 8, 2023
171e25d
✨ 취향으로 추천받기 추가
hae2ni Nov 8, 2023
11bcc68
💄 animation 추가
hae2ni Nov 8, 2023
3ad35dc
✨ 단계 노출 추가
hae2ni Nov 8, 2023
6c86c41
✨ 처음으로 가기 버튼 추가
hae2ni Nov 8, 2023
73e0c4b
🔥 쓸모없는 코드 삭제
hae2ni Nov 8, 2023
5272b6c
🔥 쓸모없는 코드 삭제
hae2ni Nov 8, 2023
4ee400a
✨ 처음으로 함수 구현
hae2ni Nov 8, 2023
a6da3f6
🔥 쓸모없는 코드 삭제
hae2ni Nov 8, 2023
4f46e5b
✨ 이전으로 돌아가도 선택되어 있도록
hae2ni Nov 8, 2023
25b6b4c
♻️ useReducer 사용
hae2ni Nov 8, 2023
8bea03d
♻️ useCallback을 이용한 최적화
hae2ni Nov 8, 2023
67bba6b
💄 공통되는 style 정리
hae2ni Nov 8, 2023
ea0381d
💄 파비콘 설정
hae2ni Nov 8, 2023
494c8a9
💄 카운트다운 할 때 글자 크기 크게 수정
hae2ni Nov 8, 2023
06736e3
💄 스타일 수정
hae2ni Nov 8, 2023
f26dab8
💄 공통된 스타일 묶기
hae2ni Nov 8, 2023
a6aa09f
💄 disabled일 때 스타일 다르게
hae2ni Nov 9, 2023
5438ce3
🚑 다시 돌아왔을 때 저장 안되는 오류 수정
hae2ni Nov 9, 2023
a274e91
📝 생각 과제
hae2ni Nov 9, 2023
47d48d0
📝 week 생각과제
hae2ni Nov 9, 2023
7855cb2
🚚 DATA.js 폴더 이동
hae2ni Nov 11, 2023
d31263a
🚚 DATA.js 폴더구조 변경
hae2ni Nov 11, 2023
0485b64
💄 styleComponent 변경
hae2ni Nov 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions assign1/DATA.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const DATA = [
{ title: "꽃속의 웰코", summary: "이뿌지!!" },
{ title: "멀보니웰코", summary: "날씨 조타!" },
{ title: "눈웃음웰코", summary: "모야! 햇빛 죠아!" },
{
title: "잠자는 말티즈으",
summary:
"말티즈가잠을자고있어요말티즈가잠을자고있어요말티즈가잠을자고있어요",
},
{ title: "사모예드가 당당티비!", summary: "아뇽! 나는 당당한 사모예에드!" },
{ title: "졸림 강얼지", summary: "졸려티비..." },
{
title: "나 귀엽지?",
summary:
"너무 귀엽구 사랑스러워 너가 다행 핑크 옷 입은 강아지가 만세를 하고 웃다니 세상을 다 가질 것 같아",
},
{
title: "우리는 두마리!",
summary:
"강아지가 두마리라니 더 사랑스럽고 너무 사랑스럽고 너무 귀엽다ㅠㅠ 아 진짜 귀엽다 어떡해,,,",
},
{ title: "무념무상", summary: "...졸려요" },
{ title: "너...너...", summary: "내가 가지고 만다" },
];

export default DATA;
141 changes: 84 additions & 57 deletions assign1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,41 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>📷먀먀먀먀먀 혠찡의 사진관티비 꺅📷</title>
<link rel="stylesheet" href="./style.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="module" src="./DATA.js"></script>
</head>
<body>
<header id="main_header"><h1>혠찡의 사진관티비 꺅</h1></header>
<main>
<section class="scroll" id="preview">
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/f569fe59-db2c-49b0-aea3-4c4d4de9a909"
alt="꽃속에서웰코" />
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/04e42574-2bc0-4645-9a29-8149f6d81d30"
alt="웃고있는웰코" />
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/643e8286-a1a0-430f-ad90-ce475fe78377"
alt="바라본당" />
<img
src="https://search.pstatic.net/sunny/?src=https%3A%2F%2Fi.pinimg.com%2F736x%2F2b%2Fb2%2F10%2F2bb210388eb9d005456df3af578745c2.jpg&type=ofullfill340_600_png"
alt="어디바" />
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/86f38ede-d8f0-42f2-a888-880b0c1f135c"
alt="크리스마스냥이" />
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2F20150521_189%2Fqparass_1432179692522fUKxm_JPEG%2FNaverBlog_20150521_124131_17.jpg&type=ofullfill340_600_png"
alt="기염댕" />
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2FMjAyMjExMjZfMTYz%2FMDAxNjY5NDY0MzE4Mzkx.dZWZtEr4da2urtDMN1rze3qSYHXtAbzIo_yV46HkJcog.OFlpulUKMQ_KL0jL1Xt-cn5dyq9SOXkoqwcIPX8LPqwg.JPEG.eunji2867%2F5787b9d7145ab7b526e05e896973590c.jpg&type=a340"
alt="만세링" />
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fcafefiles.naver.net%2F20150523_100%2Fjjun02026_1432388973865UnATH_JPEG%2F%25B8%25BB%25B8%25AE5_%25282%2529.JPG&type=sc960_832"
alt="뒹굴" />
<section id="preview">
<button type="button" id="toLeft">&lt;</button>
<article id="img_wrapper" class="scroll">
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/f569fe59-db2c-49b0-aea3-4c4d4de9a909"
alt="꽃속에서웰코" />
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/04e42574-2bc0-4645-9a29-8149f6d81d30"
alt="웃고있는웰코" />
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/643e8286-a1a0-430f-ad90-ce475fe78377"
alt="바라본당" />
<img
src="https://search.pstatic.net/sunny/?src=https%3A%2F%2Fi.pinimg.com%2F736x%2F2b%2Fb2%2F10%2F2bb210388eb9d005456df3af578745c2.jpg&type=ofullfill340_600_png"
alt="어디바" />
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/86f38ede-d8f0-42f2-a888-880b0c1f135c"
alt="크리스마스냥이" />
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2F20150521_189%2Fqparass_1432179692522fUKxm_JPEG%2FNaverBlog_20150521_124131_17.jpg&type=ofullfill340_600_png"
alt="기염댕" />
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2FMjAyMjExMjZfMTYz%2FMDAxNjY5NDY0MzE4Mzkx.dZWZtEr4da2urtDMN1rze3qSYHXtAbzIo_yV46HkJcog.OFlpulUKMQ_KL0jL1Xt-cn5dyq9SOXkoqwcIPX8LPqwg.JPEG.eunji2867%2F5787b9d7145ab7b526e05e896973590c.jpg&type=a340"
alt="만세링" />
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fcafefiles.naver.net%2F20150523_100%2Fjjun02026_1432388973865UnATH_JPEG%2F%25B8%25BB%25B8%25AE5_%25282%2529.JPG&type=sc960_832"
alt="뒹굴" />
</article>
<button type="button" id="toRight">&gt;</button>
</section>

<nav>
Expand All @@ -56,38 +62,58 @@ <h1>클릭하면 이동해요!</h1>
<h2 class="section_title">🐶아기멈무🐶</h2>
</div>
<article class="first_pic_wrapper">
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/f569fe59-db2c-49b0-aea3-4c4d4de9a909"
alt="꽃속에서웰코" />
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/643e8286-a1a0-430f-ad90-ce475fe78377"
alt="" />
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/04e42574-2bc0-4645-9a29-8149f6d81d30"
alt="웃고있는웰코" />
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/f569fe59-db2c-49b0-aea3-4c4d4de9a909"
alt="꽃속에서웰코" />
<img
src="https://search.pstatic.net/sunny/?src=https%3A%2F%2Fi.pinimg.com%2F736x%2F2b%2Fb2%2F10%2F2bb210388eb9d005456df3af578745c2.jpg&type=ofullfill340_600_png"
alt="어디바" />
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2F20150521_189%2Fqparass_1432179692522fUKxm_JPEG%2FNaverBlog_20150521_124131_17.jpg&type=ofullfill340_600_png"
alt="기염댕" />
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2FMjAyMjExMjZfMTYz%2FMDAxNjY5NDY0MzE4Mzkx.dZWZtEr4da2urtDMN1rze3qSYHXtAbzIo_yV46HkJcog.OFlpulUKMQ_KL0jL1Xt-cn5dyq9SOXkoqwcIPX8LPqwg.JPEG.eunji2867%2F5787b9d7145ab7b526e05e896973590c.jpg&type=a340"
alt="만세링" />
<img
src="https://search.pstatic.net/sunny/?src=https%3A%2F%2Fi.pinimg.com%2F736x%2Fcc%2Fb2%2Ff2%2Fccb2f2e4efcd7c98ba8d0ebf9693a158.jpg&type=a340"
alt="두마리지롱" />
<img
class="media_small"
src="https://search.pstatic.net/sunny/?src=https%3A%2F%2Fi.pinimg.com%2F736x%2Fb9%2F21%2F55%2Fb9215568498d0017edf37d607b086dd5.jpg&type=sc960_832"
alt="어디가" />
<img
class="media_small"
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2FMjAyMjA4MTVfMTUg%2FMDAxNjYwNTMwNDAxMTgw.cwvPNFHDd2kqQS5kB4y2tItlt7rwPdUvALarWkHEgwcg.7WpqASll1KKH9BvsSUri5elJG-vNRGwQ3yocRmiyz4wg.JPEG.summervacation1%2FIMG_8776.JPG&type=ofullfill340_600_png"
alt="사과먹구싶다" />
<div class="first_section_pic">
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/f569fe59-db2c-49b0-aea3-4c4d4de9a909"
alt="꽃속에서웰코" />
</div>
<div class="first_section_pic">
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/643e8286-a1a0-430f-ad90-ce475fe78377"
alt="멀보니웰코" />
</div>
<div class="first_section_pic">
<img
src="https://github.com/DO-SOPT-WEB/HyeinKwon/assets/100409061/04e42574-2bc0-4645-9a29-8149f6d81d30"
alt="웃고있는웰코" />
</div>
<div class="first_section_pic">
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2FMjAyMTA5MzBfMTYz%2FMDAxNjMyOTQxNTMyNTQ3.V9Hj_HKiiw5QHhgJexI9XzMejk_8JQkJjHu7SPIcEYUg.tH2oDp1qOWtg_L1uDIDkv8SGAuJ-lIwDOaWBv0-1jyIg.JPEG.jisu9610042%2FIMG_6965.JPG&type=sc960_832"
alt="잠든 말티쥬" />
</div>
<div class="first_section_pic">
<img
src="https://search.pstatic.net/sunny/?src=https%3A%2F%2Fi.pinimg.com%2F736x%2F2b%2Fb2%2F10%2F2bb210388eb9d005456df3af578745c2.jpg&type=ofullfill340_600_png"
alt="어디바" />
</div>
<div class="first_section_pic">
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2F20150521_189%2Fqparass_1432179692522fUKxm_JPEG%2FNaverBlog_20150521_124131_17.jpg&type=ofullfill340_600_png"
alt="기염댕" />
</div>
<div class="first_section_pic">
<img
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2FMjAyMjExMjZfMTYz%2FMDAxNjY5NDY0MzE4Mzkx.dZWZtEr4da2urtDMN1rze3qSYHXtAbzIo_yV46HkJcog.OFlpulUKMQ_KL0jL1Xt-cn5dyq9SOXkoqwcIPX8LPqwg.JPEG.eunji2867%2F5787b9d7145ab7b526e05e896973590c.jpg&type=a340"
alt="만세링" />
</div>
<div class="first_section_pic">
<img
src="https://search.pstatic.net/sunny/?src=https%3A%2F%2Fi.pinimg.com%2F736x%2Fcc%2Fb2%2Ff2%2Fccb2f2e4efcd7c98ba8d0ebf9693a158.jpg&type=a340"
alt="두마리지롱" />
</div>
<div class="first_section_pic">
<img
class="media_small"
src="https://search.pstatic.net/sunny/?src=https%3A%2F%2Fi.pinimg.com%2F736x%2Fb9%2F21%2F55%2Fb9215568498d0017edf37d607b086dd5.jpg&type=sc960_832"
alt="어디가" />
</div>
<div class="first_section_pic">
<img
class="media_small"
src="https://search.pstatic.net/common/?src=http%3A%2F%2Fblogfiles.naver.net%2FMjAyMjA4MTVfMTUg%2FMDAxNjYwNTMwNDAxMTgw.cwvPNFHDd2kqQS5kB4y2tItlt7rwPdUvALarWkHEgwcg.7WpqASll1KKH9BvsSUri5elJG-vNRGwQ3yocRmiyz4wg.JPEG.summervacation1%2FIMG_8776.JPG&type=ofullfill340_600_png"
alt="사과먹구싶다" />
</div>
</article>
</section>

Expand Down Expand Up @@ -166,5 +192,6 @@ <h2 class="section_title">🐣다른아가들🐣</h2>
<footer>
<h1>귀여워찌??</h1>
</footer>
<script type="module" src="index.js"></script>
</body>
</html>
97 changes: 97 additions & 0 deletions assign1/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import DATA from "./DATA.js";

const $ = (selector) => document.querySelector(selector);
const $$ = (selector) => document.querySelectorAll(selector);

// 1.a , b
const firstImages = document.querySelectorAll(".first_section_pic");

//더보기 버튼 생성
const moreBtn = document.createElement("button");
moreBtn.classList.add("more_button");
moreBtn.innerText = "더보기";

firstImages.forEach((pic, index) => {
const h2 = document.createElement("h2");
h2.classList.add("title");
const p = document.createElement("p");
p.classList.add("summary");
const { title, summary } = DATA[index];

let moreBtnClicked = false;

pic.addEventListener("mouseover", function () {
pic.childNodes[1].classList.add("addTitle");
pic.classList.add("addTitle");
h2.innerText = title;

const div = document.createElement("div");
div.classList.add("title_summary_wrapper");
div.appendChild(h2);
p.innerText = summary;
div.appendChild(p);
pic.appendChild(div);

//심화 1번
const pHeight = p.clientHeight;
const summaryHeight = p.scrollHeight;

if (pHeight < summaryHeight) {
div.appendChild(moreBtn);
!moreBtnClicked ? (moreBtn.style.display = "flex") : null;
moreBtn.addEventListener("click", () => {
p.classList.replace("summary", "summaryAll");
moreBtn.style.display = "none";
});
}
moreBtn.addEventListener("click", () => {
p.classList.replace("summary", "summaryAll");
moreBtnClicked = true;
moreBtn.style.display = "none";
});
});

pic.addEventListener("mouseleave", function () {
pic.classList.remove("addTitle");
h2.innerText = "";
p.innerText = "";
p.classList.replace("summaryAll", "summary");
moreBtn.style.display = "none";
moreBtnClicked = false;
});
});

//2.a
const gotopBtn = document.getElementById("gotop_btn");
window.addEventListener("scroll", () => {
const scrollY = window.scrollY;
const maxScroll = document.body.clientHeight - window.innerHeight;
const opacity = scrollY / maxScroll;
gotopBtn.style.opacity = opacity;
});

//심화 2번
const preview = document.getElementById("preview");
const article = document.getElementById("img_wrapper");
const toLeft = document.getElementById("toLeft");
const toRight = document.getElementById("toRight");

toLeft.addEventListener("click", () => {
const articleWidth = article.scrollLeft;
const articleWidthh = article.scrollRight;
console.log(articleWidth, articleWidthh);
article.scrollTo({
left: articleWidth - 150,
behavior: "smooth",
});
});

toRight.addEventListener("click", () => {
const articleWidth = article.scrollLeft;
const articleWidthh = article.scrollRight;
console.log(articleWidth, articleWidthh);
article.scrollTo({
left: articleWidth + 150,
behavior: "smooth",
});
});
Loading