๋ฌธ์์ด์ ๊ธ์๋ณ๋ก ์๋ฅธ ๋ค ์ ์ฒด์ ์ผ๋ก ๋๋ฆฌ๋ ์ ๋๋ฉ์ด์ ์ ๊ตฌํํด ๋ณด์๋ค. ๋ฌธ์์ด์ ์๋ฅด๊ธฐ ์ํด ๊ฐ์ ธ์จ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
๊ทผ๋ฐ ๋จ์ด๋ณ์ด ์๋๋ผ ๊ธ์๋ณ์ด๋ผ์ ์กฐ๊ธ ์์ฌ์ ๋ค. js ์ฝ๋๋ฅผ ๋ฐ๊ฟ๋ณด๋ ค๊ณ ํ์ง๋ง... ๋ด๋ ์ ๋ชจ๋ฅด๊ฒ ์ด์..... --์ผ๋ก ์ซ์์ ๊ตฌ๋ถ์ ์ฃผ๋ ๋ฐฉ๋ฒ์ผ๋ก ๊ตฌํํ์ง๋ง, ๋์ค์ ๋จ์ด ๋จ์๋ก ๊ตฌํ๋ ํด๋ณด๊ณ ์ถ๋ค.
input ๊ฐ์ ๊ฒ font-size ์๋ฐ๋๊ฑฐ default๊ฐ inherit ์ผ๋ก ์๋์ด ์์ด์ ๊ทธ๋ผ... reset์ inherit์ผ๋ก ์ค์ ํ๋ฉด ๋๋ค.
js ๋ ๋ชจ๋ฅด์ง๋ง js ์ธ๊ธ์ ๋ง์ด ๋ฃ๋ค๋ณด๋ ๊ฐ์์์๋ฅผ ์์ฐ๊ณ on off ํ์๋ ์ฐ๋ฉด ๋๊ฒ ๋ค ์ถ์ด์ ๋ฒํผ ์์ sold-out class ๋ฅผ ์ค์ back-sold-out ์ด sold-out ์ด๋ฉด ๋ํ๋๊ณ ์๋๋ฉด ๋ํ๋์ง ์๊ฒ ํด๋ณด๋ ค๊ณ ํ๋ค. ์ง๊ธ์ ๋ชปํ๊ณ ๋์ค์...
<li class="sold-out">
<div class="back-sold-out">
<img src="resource/img/Sold-out.png" alt="">
</div>
๋ฒํผ์ด์ฉ๊ณ ~~
ํฌ๋กฌ์ ์ต์ ํฐํธ ์ฌ์ด์ฆ๋ 10px
๋ฒํผ ์์ ์์๋ค์ ์์๋ ์ ๋ถ ๊ฐ์ด๋ฐ ์ ๋ ฌ์ด ์๋์ผ๋ก ๋๋ค!!!
flex๋ก ์ก์ ๋ width, flex-basis, flex-grow ... ๋ฑ ๋จ์๋ฅผ ์ค ๋๋ ๋ฌด์กฐ๊ฑด ํ๋๋ก ํต์ผํ์!!! ์ฌ๋ฌ๊ฐ์ง๋ก ์ฃผ๋ฉด ์ฐ์ ์์๊ฐ ๋ฌ๋ผ์ ๋ค๋ฅด๊ฒ ์ ์ฉ๋ ์ ์๋ค.
js์ ํต์ฌ์ HTML์ interactive ํ๊ฒ ๋ง๋๋ ๊ฒ.
HTML์ ์ ์ฉํ๊ธฐ ๐งฎ
document // HTML์ ๊ฐ๋ฆฌํค๋ Object document.title = "hi"; // const title = document.getElementById("title"); document.dir(title); // element๊ฐ ๊ฐ์ง๊ณ ์๋ ์ ๋ณด๋ค์ ์ก์์ด. ex) onClick, onDrag ... title.innerText = "text"; // h1 ๋ด์ฉ ๋ฐ๋๋ค. // const title = document.getElementsByClassName("hello"); const title = document.getElementsByTagName("h1"); const title = document.querySelector(".hello h1:first-child"); // CSS selector ๋ฌธ๋ฒ์ ํด๋นํ๋ ์ฒซ๋ฒ์งธ ๊ฒ ๋ฑ ํ๋๋ง ์ก์์ด. const title = document.querySelectorAll(".hello h1"); // ์ ๋ถ list๋ก ์ก์์ด. // // style ์ js๋ก ๋ฐ๊ฟ ์ ์๋ค. title.style.color = "blue";
<div class="hello"> <h1 class="hello" id="title">Grab me!</h1> <h1 class="hello">Grab me!</h1> <h1>Grab me!</h1> </div>
Event ๐ฅณ
๋ฐฉ๋ฒ1. addEventListener ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ// ์ด๋ค event๋ฅผ ๊ฐ์งํ ์ง, event๊ฐ ๊ฐ์ง๋์ ๋ ์คํํ ํจ์. // event๋ ์ข ๋ฅ๊ฐ ๋ง์ผ๋๊น ์ฐพ์์ ์ฐ์. click, mouseenter, mouseleave, ... function handleTitleClick() { title.style.color = "green"; } title.addEventListener("click", handleTitleClick); // function handelWindowResize() { // body ๋ ํน๋ณํ๊ธฐ ๋๋ฌธ์ document.body๋ก ๊ฐ์ ธ์ฌ ์ ์์ง๋ง, div, h1 ๊ฐ์ ๊ฒ์ ์๋จ. ์์์ ์ฌ์ฉํ get~~ or querySelector ์ด์ฉํ์. document.body.style.backgroundColor = "tomato"; } window.addEventListener("resize", handleWindowResize);
๋ฐฉ๋ฒ2. onEvent ๋ถ์ด๊ธฐ
title.onclick = handleTitleClick;
addEventLisnter๋ iOS addTapGestureRecognizer ์ ์ด๋ฆ๋ง ๋ค๋ฅด๊ณ ๊ฐ๋ค!!