-
Notifications
You must be signed in to change notification settings - Fork 1
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
[2주차 기본/심화 과제] 웨비의 사진관 😋 #4
Changes from all commits
e425894
8bf3228
7348a96
c592135
c34a82d
adc3f9d
f5a0490
b33f1b5
7872707
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>film archive</title> | ||
<link rel="stylesheet" href="style.css" /> | ||
<link rel="icon" href="./images/assign3-favicon.png" /> | ||
</head> | ||
<body> | ||
<div id="top" class="onboarding"> | ||
<header>film archive</header> | ||
<!-- 미리보기 가로스크롤 --> | ||
<div class="onboarding-scroll-wrapper"> | ||
<button id="scroll-left-btn" type="button"><</button> | ||
<section id="onboarding-scroll"> | ||
<img src="./images/onboarding/1.png" alt="바다 잠수" /> | ||
<img src="./images/onboarding/2.png" alt="노을지는 오이도" /> | ||
<img src="./images/onboarding/3.png" alt="엉켜 자는 두 고양이" /> | ||
<img | ||
src="./images/onboarding/4.png" | ||
alt="바닷가에서 노는 두 어린이" | ||
/> | ||
<img src="./images/onboarding/5.png" alt="산책하는 사람과 강아지" /> | ||
<img src="./images/onboarding/6.png" alt="카메라를 들고 거울 찍기" /> | ||
<img src="./images/onboarding/7.png" alt="벤치 위 두 고양이" /> | ||
<img src="./images/onboarding/8.png" alt="나무 그늘진 거리" /> | ||
<img | ||
src="./images/onboarding/9.png" | ||
alt="스프카레를 기다리며 거울 찍기" | ||
/> | ||
<img src="./images/onboarding/10.png" alt="산책하는 모자" /> | ||
</section> | ||
<button id="scroll-right-btn" type="button">></button> | ||
</div> | ||
</div> | ||
<nav class="onboarding-nav"> | ||
<a href="#first-section-anchor"><h3 class="nav-category">2023</h3></a> | ||
<a href="#second-section-anchor"><h3 class="nav-category">2022</h3></a> | ||
<a href="#third-section-anchor"><h3 class="nav-category">2021</h3></a> | ||
</nav> | ||
<main> | ||
<section id="first-section-anchor"> | ||
<h1>2023</h1> | ||
<div class="halftone first-section-gallery"> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Sogang Univ North Gate</h3> | ||
<p> | ||
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem | ||
ipsum dolor sit amet. Lorem | ||
</p> | ||
</div> | ||
<img src="./images/section1/1.png" alt="서강대학교 남문" /> | ||
</div> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Hangang Park</h3> | ||
<p> | ||
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem | ||
ipsum dolor sit amet. Lorem | ||
</p> | ||
</div> | ||
<img src="./images/section1/2.png" alt="뚝섬 한강공원" /> | ||
</div> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Artist GrandFa</h3> | ||
<p> | ||
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem | ||
ipsum dolor sit amet. Lorem | ||
</p> | ||
</div> | ||
<img | ||
src="./images/section1/3.png" | ||
alt="오타루 운하를 그리는 할아버지" | ||
/> | ||
</div> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Japan Bridge</h3> | ||
<p>Lorem ipsum dolor sit amet consectetur adipisicing.</p> | ||
</div> | ||
<img src="./images/section1/4.png" alt="일본 육교" /> | ||
</div> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Self Camera</h3> | ||
<p>Lorem ipsum dolor sit amet consectetur adipisicing.</p> | ||
</div> | ||
<img src="./images/section1/5.png" alt="강가에서 셀프 카메라" /> | ||
</div> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Otaru Street</h3> | ||
<p>Lorem ipsum dolor sit amet consectetur adipisicing.</p> | ||
</div> | ||
<img src="./images/section1/6.png" alt="오타루 거리" /> | ||
</div> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Cats on the Bench</h3> | ||
<p>Lorem ipsum dolor sit amet consectetur adipisicing.</p> | ||
</div> | ||
<img src="./images/section1/7.png" alt="벤치 위 두 고양이" /> | ||
</div> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Japan Street</h3> | ||
<p>Lorem ipsum dolor sit amet consectetur adipisicing.</p> | ||
</div> | ||
<img src="./images/section1/8.png" alt="일본 거리 신호등 앞" /> | ||
</div> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Japan Bridge</h3> | ||
<p>Lorem ipsum dolor sit amet consectetur adipisicing.</p> | ||
</div> | ||
<img src="./images/section1/9.png" alt="일본 육교 위" /> | ||
</div> | ||
<div class="overlay-wrapper"> | ||
<div class="content"> | ||
<h3>Sapporo Stream</h3> | ||
<p> | ||
Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem | ||
ipsum dolor sit amet. Lorem | ||
</p> | ||
</div> | ||
<img src="./images/section1/10.png" alt="삿포로 하천" /> | ||
</div> | ||
</div> | ||
</section> | ||
<section id="second-section-anchor"> | ||
<h1>2022</h1> | ||
<div class="halftone second-section-gallery"> | ||
<img | ||
class="first-img" | ||
src="./images/section2/1.png" | ||
alt="예쁜 커튼과 침구의 방" | ||
/> | ||
<div class="right-side"> | ||
<img src="./images/section2/2.png" alt="빛이 비친 팔과 손" /> | ||
<img | ||
src="./images/section2/3.png" | ||
alt="카메라를 들고 친구와 거울 찍기" | ||
/> | ||
<img src="./images/section2/4.png" alt="오사카 밤거리" /> | ||
<img | ||
class="last-img" | ||
src="./images/section2/5.png" | ||
alt="걸터 앉아 셀프카메라" | ||
/> | ||
</div> | ||
</div> | ||
</section> | ||
<section id="third-section-anchor"> | ||
<h1>2021</h1> | ||
<div class="halftone third-section-gallery"> | ||
<img | ||
class="grid-item" | ||
src="./images/section3/1.png" | ||
alt="빛이 비치는 송내역" | ||
/> | ||
<img | ||
class="grid-item" | ||
src="./images/section3/3.png" | ||
alt="크리스마스 케이크" | ||
/> | ||
<img | ||
class="grid-item" | ||
src="./images/section3/2.png" | ||
alt="책 읽는 두 사람" | ||
/> | ||
<img | ||
class="grid-item" | ||
src="./images/section3/5.png" | ||
alt="잔디밭 고양이" | ||
/> | ||
<img | ||
class="grid-item" | ||
src="./images/section3/4.png" | ||
alt="롯데월드에서 친구들과 셀프카메라" | ||
/> | ||
</div> | ||
</section> | ||
</main> | ||
<a id="top-btn" href="#top"> | ||
<button type="button">▴</button> | ||
</a> | ||
<footer>end</footer> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/*** | ||
The new CSS reset - version 1.11 (last updated 20.9.2023) | ||
GitHub page: https://github.com/elad2412/the-new-css-reset | ||
***/ | ||
|
||
/* | ||
Remove all the styles of the "User-Agent-Stylesheet", except for the 'display' property | ||
- The "symbol *" part is to solve Firefox SVG sprite bug | ||
- The "html" element is excluded, otherwise a bug in Chrome breaks the CSS hyphens property (https://github.com/elad2412/the-new-css-reset/issues/36) | ||
*/ | ||
*:where( | ||
:not(html, iframe, canvas, img, svg, video, audio):not(svg *, symbol *) | ||
) { | ||
all: unset; | ||
display: revert; | ||
} | ||
|
||
/* Preferred box-sizing value */ | ||
*, | ||
*::before, | ||
*::after { | ||
box-sizing: border-box; | ||
} | ||
|
||
/* Fix mobile Safari increase font-size on landscape mode */ | ||
html { | ||
-moz-text-size-adjust: none; | ||
-webkit-text-size-adjust: none; | ||
text-size-adjust: none; | ||
} | ||
|
||
/* Reapply the pointer cursor for anchor tags */ | ||
a, | ||
button { | ||
cursor: revert; | ||
} | ||
|
||
/* Remove list styles (bullets/numbers) */ | ||
ol, | ||
ul, | ||
menu { | ||
list-style: none; | ||
} | ||
|
||
/* For images to not be able to exceed their container */ | ||
img { | ||
max-inline-size: 100%; | ||
max-block-size: 100%; | ||
} | ||
|
||
/* removes spacing between cells in tables */ | ||
table { | ||
border-collapse: collapse; | ||
} | ||
|
||
/* Safari - solving issue when using user-select:none on the <body> text input doesn't working */ | ||
input, | ||
textarea { | ||
-webkit-user-select: auto; | ||
} | ||
|
||
/* revert the 'white-space' property for textarea elements on Safari */ | ||
textarea { | ||
white-space: revert; | ||
} | ||
|
||
/* minimum style to allow to style meter element */ | ||
meter { | ||
-webkit-appearance: revert; | ||
appearance: revert; | ||
} | ||
|
||
/* preformatted text - use only for this feature */ | ||
:where(pre) { | ||
all: revert; | ||
box-sizing: border-box; | ||
} | ||
|
||
/* reset default text opacity of input placeholder */ | ||
::placeholder { | ||
color: unset; | ||
} | ||
|
||
/* remove default dot (•) sign */ | ||
::marker { | ||
content: initial; | ||
} | ||
|
||
/* fix the feature of 'hidden' attribute. | ||
display:revert; revert to element instead of attribute */ | ||
:where([hidden]) { | ||
display: none; | ||
} | ||
|
||
/* revert for bug in Chromium browsers | ||
- fix for the content editable attribute will work properly. | ||
- webkit-user-select: auto; added for Safari in case of using user-select:none on wrapper element*/ | ||
:where([contenteditable]:not([contenteditable="false"])) { | ||
-moz-user-modify: read-write; | ||
-webkit-user-modify: read-write; | ||
overflow-wrap: break-word; | ||
-webkit-line-break: after-white-space; | ||
-webkit-user-select: auto; | ||
} | ||
|
||
/* apply back the draggable feature - exist only in Chromium and Safari */ | ||
:where([draggable="true"]) { | ||
-webkit-user-drag: element; | ||
} | ||
|
||
/* Revert Modal native behavior */ | ||
:where(dialog:modal) { | ||
all: revert; | ||
box-sizing: border-box; | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,47 @@ | ||||||||||||
/* 스크롤에 따른 topBtn 투명도 */ | ||||||||||||
|
||||||||||||
const windowHeight = window.innerHeight; | ||||||||||||
const topBtn = document.getElementById("top-btn"); | ||||||||||||
|
||||||||||||
document.addEventListener("scroll", () => { | ||||||||||||
topBtn.style.opacity = window.scrollY / windowHeight / 2; | ||||||||||||
}); | ||||||||||||
|
||||||||||||
/* 글자수에 따른 더보기 버튼 활성화 및 작동 */ | ||||||||||||
|
||||||||||||
const contents = document.querySelectorAll(".content"); | ||||||||||||
contents.forEach((content) => { | ||||||||||||
const contentDescription = content.children[1]; | ||||||||||||
Comment on lines
+12
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
요렇게 가능하지 않나용? |
||||||||||||
if (contentDescription.innerText.length >= 85) { | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR에 적어준 부분인 것 같아서,
Suggested change
저는 이런식으로 사용해서 구현했어용 참고 !~! |
||||||||||||
const moreBtn = document.createElement("button"); //button 요소 생성 | ||||||||||||
moreBtn.innerText = "more"; | ||||||||||||
moreBtn.setAttribute("class", "content-more-btn"); //button 클래스명 지정 | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setAttribute 외에도 classList.add 를 이용하는 방식도 있어요!! 이를 이용하는 것이 속도면에서 더 빠르다는 얘기가 있네요~ 한 번 참고해 보시는 것도 좋을 거 같아요!! 참고자료 https://measurethat.net/Benchmarks/Show/54/0/classname-vs-setattribute-vs-classlist |
||||||||||||
|
||||||||||||
content.appendChild(moreBtn); //button 붙이기 | ||||||||||||
|
||||||||||||
/* 클릭 이벤트시 버튼 사라짐 */ | ||||||||||||
content.addEventListener("click", () => { | ||||||||||||
contentDescription.style.display = "block"; //말줄임 표시를 없앰 | ||||||||||||
moreBtn.style.display = "none"; | ||||||||||||
}); | ||||||||||||
Comment on lines
+23
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addEventListener가 content에 있는데 버튼 클릭 시가 아니라 내용 클릭시 내용이 다 보이게 구현하신건가용..? |
||||||||||||
} | ||||||||||||
}); | ||||||||||||
|
||||||||||||
/* 미리보기 섹션 스크롤 버튼 */ | ||||||||||||
const scrollLeftBtn = document.getElementById("scroll-left-btn"); | ||||||||||||
const scrollRightBtn = document.getElementById("scroll-right-btn"); | ||||||||||||
|
||||||||||||
const onboardingScroll = document.getElementById("onboarding-scroll"); | ||||||||||||
const maxScrollWidth = onboardingScroll.scrollWidth; | ||||||||||||
|
||||||||||||
scrollLeftBtn.addEventListener("click", () => { | ||||||||||||
onboardingScroll.scrollTo({ top: 0, left: 0, behavior: "smooth" }); | ||||||||||||
}); | ||||||||||||
|
||||||||||||
scrollRightBtn.addEventListener("click", () => { | ||||||||||||
onboardingScroll.scrollTo({ | ||||||||||||
top: 0, | ||||||||||||
left: maxScrollWidth, | ||||||||||||
behavior: "smooth", | ||||||||||||
}); | ||||||||||||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 y축 스크롤 된거를 스크롤할 수 있는 최대치로 나눠서 구현했는데 이렇게도 할 수 있군요!