์ฒซ ๋ฐฐํฌ์ฌ์ดํธ..! ์๋์ ๋งํฌ๋ฅผ ํด๋ฆญํ์๋ฉด ๋ฉ๋๋ค.
https://sohwakyeong.github.io/hwakyeong/
Html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel = "stylesheet" href="css/app.css">
<title>Momentum</title>
</head>
<body>
<form class="hidden" id="login-form">
<input type="text" />
<button id="button">Log In</button>
</form>
<h2 id ="clock">00:00:00</h2>
<h1 id="greeting" class="hidden"></h1>
<div id="quote">
<span></span>
<span></span>
</div>
<script src="js/clock.js"></script>
<script src="js/greeting.js"></script>
<script src="js/quotes.js"></script>
<script src="js/background.js"></script>
</body>
</html>
/*quotes:๋ช
์ธ์ํ๊ธฐ ๋ง๋ค๊ธฐ.*/
const quotes = [
{
quote: "๋๋ ์คํจํ ์ ์ด ์์ด. ๋จ์ง 10,000๋ฒ ๋์ ํด๋ณด๊ณ ์ด๋ค ๊ฒ์ด ๋์ํ์ง ์๋์ง ์ ๋ฟ์ด์ง.",
author:"<์ฌ๋จ๋ฉํฌ>",
},
{
quote: "๋ง์์ด ์ง์ ๋๋ฉด ๊ทธ ์๋ฆฌ๋ฅผ ๋ค์ ์ ์๋ค.",
author: "<์ผ๊ณผ ์นํ๋ก์ ํ๋ฐฉ๋ถ๋ช
>",
},
{
quote: "์์ฒ๋ ์์พํ๋ค. ๊ทธ๊ฑด ๋๋ฅผ ๊ฐํ๊ฒ ๋ง๋ค์ด์ค๋ค",
author: "<๋๋ผ์๋ชฝ>",
},
{
quote: "๊ฟ์ ํ๋ค๋ฆด ์ ์์ง๋ง, ํฌ๊ธฐํ๋ฉด ๊ฒฐ์ฝ ์ด๋ฃจ์ด์ง ์ ์๋ค.",
author: "<๋์ ์ด๋ฆ์>",
},
{
quote: "์ธ์์ ํ ๋ฐฉ! ๋ ๋ฒ ๋ค์๋ ์์ด!",
author: "<์ผ์>",
},
{
quote: "๋ฏธ๋์ ๋ํ ๊ณ ๋ฏผ์ ์ง๊ธ ์ฌ๋ฅ์ ๋ฌป๋ ๊ฒ์ด๋ค.",
author: "<ํ์ดํ>",
},
{
quote: "๋ง์์ ๋ถ์ด ์์ด์ผ ๋ถ์ด ๋ฒ์ง๋ ๋ฒ์ด์ง!",
author: "<๊ท๋ฉธ์ ์นผ๋ >",
},
{
quote: "๊ฐ์ฅ ์ค์ํ ๊ฑด ๋ค ์์ ํ์ด๋ค.",
author: "<๋๋ฃจํ >",
},
{
quote: "์ฐ๋ฆฌ๋ ํผ์๊ฐ ์๋์ผ, ์ธ์ ๋ ์์ ๋ค๊ฐ ์๋ค๋ ๊ฑธ ์์.",
author: "<๋ฐ์ง์ ์ ์>",
},
{
quote: "๋ง์์ด ์์ง์ฌ์ผ ์ด๋ช
๋ ์์ง์ธ๋ค.",
author: "<ํ๋ฉํ ์์ผ๋ฏธ์คํธ>",
}
]
const quote = document.querySelector('#quote span:first-child');
const author = document.querySelector('#quote span:last-child');
const todaysQuote = quotes[Math.floor(Math.random() * quotes.length)];
quote.innerText = todaysQuote.quote;
author.innerText = todaysQuote.author;
//randomness(๋ฌด์์์ฑ): array ์์ element์ ์ ๊ทผํ๊ธฐ.
//console.log(quotes[10 - 1]); ๋ง์ง๋ง ์์์ ์ ๊ทผ .
/*Math.random():between 0 ~ 1.
Math.round():๋ฐ์ฌ๋ฆผ
Math.ceil():์ฌ๋ฆผ
Math.floor():๋ด๋ฆผ*/
const images = [
"pochako1.jpg",
"pochako2.jpg",
"pochako3.jpg"
];
const chosenImage = images[Math.floor(Math.random() * images.length)];
const bgImage = document.createElement("img");
bgImage.src = `img/${chosenImage}`;
document.body.appendChild(bgImage);
//append ๋ ๊ฐ์ฅ ๋ค , prepend๋ ๊ฐ์ฅ ์์ ์จ๋ค.
.hidden {
display: none;
}
#quote span {
font-weight: bold;
}
#quote {
position: absolute;
top: 900px;
left: 800px;
}
#greeting
{
position: absolute;
top: 200px;
left: 900px;
}
#clock
{
position: absolute;
top: 800px;
left: 950px;
}
//๋ฐ๋ผ๋ง ํ๋ , ์ฌ๋ฏธ๊ฐ ์์ด์ css๋ก ๊พธ๋ช๋๋ฐ ๋ณ๋กํ๊ฑด ์์ง๋ง ๋ฟ๋ฏํ๋ค..!
์ค๋ ๊นํ๋ธ์์ ์ฒ์์ผ๋ก pages๊ธฐ๋ฅ์ ์ด์ฉํด์ ์ฌ์ดํธ ๋ฐฐํฌ๋ฅผ ์์ฑํ๋ค..!
404 ์ค๋ฅ๋ฅผ ๋ง๋ฌ์ง๋ง , index.html๋ก ๋ฐ๊ฟ์ ๊ทน๋ณต ..!