knock4293693
@knock4293693
Reviews Written
2
Average Rating
4.5
Posts
Q&A
๋ญ๊ฐ ๋ฌธ์ ์ผ๊น์ ใ ใ
์ฌ๊ธฐ์ ๋ฌธ์ ๊ฐ ์๋์ ?
- 1
- 5
- 1.3K
Q&A
๋ญ๊ฐ ๋ฌธ์ ์ผ๊น์ ใ ใ
const main = document.querySelector("#main"); const qna = document.querySelector("#qna"); const result = document.querySelector("#result"); const endPoint = 12; const select = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; function calResult(){ var result = select.indexOf(Math.max(...select)); return result; } function setResult(){ let point = calResult(); const resultName = document.querySelector('.resultname'); resultName.innerHTML = infoList[point].name; var resultImg = document.createElement('img'); const imgDiv = document.querySelector('#resultImg'); var imgURL = 'img/image-' + point + '.png'; resultImg.src = imgURL; resultImg.alt = point; resultImg.classList.add('img-fluid'); imgDiv.appendChild(resultImg); const resultDesc = document.querySelector('.resultDesc'); resultDesc.innerHTML = infoList[point].desc; } function setResult(){ let point = calResult(); const resultName = document.querySelector('.resultname'); resultName.innerHTML = infoList[point].name; var resultImg = document.createElement('img') const imgDiv = document.querySelector('#resultImg'); var imageUrl = 'img/image-' + point + '.png'; resultImg.src = imageUrl; resultImg.alt = point imgDiv.appendChild(resultImg); const resultDesc = document.querySelector('.resultDesc'); resultDesc.innerHTML = infoList[point].desc; } function goResult(){ qna.style.WebkitAnimation = "fadeOut 1s"; qna.style.animation = "fadeOut 1s"; setTimeout(() => { result.style.WebkitAnimation = "fadeIn 1s"; result.style.animation = "fadeIn 1s"; setTimeout(() => { qna.style.display = "none"; result.style.display = "block" }, 450)}) console.log(select); calResult(); } function addAnswer(answerText, qIdx, idx){ var a = document.querySelector('.answerBox'); var answer = document.createElement('button'); answer.classList.add('answerList'); answer.classList.add('my-3'); answer.classList.add('py-3'); answer.classList.add('mx-auto'); answer.classList.add('fadeIn'); a.appendChild(answer); answer.innerHTML = answerText; answer.addEventListener("click", function(){ var children = document.querySelectorAll('.answerList'); for(let i = 0; i children[i].disabled = true; children[i].style.WebkitAnimation = "fadeOut 0.5s"; children[i].style.animation = "fadeOut 0.5s"; } setTimeout(() => { var target = qnaList[qIdx].a[idx].type; for(let i = 0; i select[target[i]] += 1; } for(let i = 0; i children[i].style.display = 'none'; } goNext(++qIdx); },450) }, false); } function goNext(qIdx){ if(qIdx === endPoint){ goResult(); return; } var q = document.querySelector('.qBox'); q.innerHTML = qnaList[qIdx].q; for(let i in qnaList[qIdx].a){ addAnswer(qnaList[qIdx].a[i].answer, qIdx, i); } var status = document.querySelector('.statusBar'); status.style.width = (100/endPoint) * (qIdx+1) + '%'; } function begin(){ main.style.WebkitAnimation = "fadeOut 1s"; main.style.animation = "fadeOut 1s"; setTimeout(() => { qna.style.WebkitAnimation = "fadeIn 1s"; qna.style.animation = "fadeIn 1s"; setTimeout(() => { main.style.display = "none"; qna.style.display = "block" }, 450) let qIdx = 0; goNext(qIdx); }, 450); }
- 1
- 5
- 1.3K
Q&A
๋ญ๊ฐ ๋ฌธ์ ์ผ๊น์ ใ ใ
์ด์ ๋ ๊ทธ๋ฅ ๊ฐ์ด ์ถ๋ ฅ์ด ๋๋๊ฑฐ๋ ์๋ค์ ใ ใ ใ
- 1
- 5
- 1.3K
Q&A
๋ญ๊ฐ ๋ฌธ์ ์ฃ ใ ใ
๊ทธ๋ฆฌ๊ณ ๊ณ์ fadeIn fadeOut๋ฅผ ์ ์์ ์ผ๋ก ์์ฑํ์์๋ ๋ถ๊ตฌํ๊ณ ๊ณ์ ๊ทธ๋ฅ ๋ฑ๋ฑํ๊ฒ ๋์ด๊ฐ๋๋ฐ ์ด๊ฑด ์ ๊ทธ๋ด๊น์ ใ
- 2
- 6
- 606
Q&A
๋ญ๊ฐ ๋ฌธ์ ์ฃ ใ ใ
4๋ถ 50์ด ์ฏค์ ์์ํ๊ธฐ ๋ฒํผ์ ๋๋ฌ ๋์ด๊ฐ๋๊ฒ ์๋์ ! ๋ญ๊ฐ ๋ฌธ์ ์ธ์ง๋ฅผ ๋ชจ๋ฅด๊ฒ ์ด์ ใ
- 2
- 6
- 606
Q&A
๋ญ๊ฐ ๋ฌธ์ ์ฃ ใ ใ
start.js const main = document.querySelector("#main"); const qna = document.querySelector("#qna"); function begin(){ main.style.WebkitAnimation = "fadeOut 1s"; main.style.animation = "fadeOut 1s"; qna.style.WebkitAnimation = "fadeIn 1s"; qna.style.animation = "fadeIn 1s"; //main.style.display = "none"; //qna.style.display = "block"; }
- 2
- 6
- 606
Q&A
๋ญ๊ฐ ๋ฌธ์ ์ฃ ใ ใ
index.html ์ญ์ด๋ก ์์๋ณด๋ ์ฐ์ ์ ํ (์ฌ์ง) ๋๋ง์ MBTI ์ฌ์ดํธ์ ๋๋ค! ์์ํ๊ธฐ ๋ฒํผ์ ๋๋ฅด๋ฉด ์์ํฉ๋๋ค. ์์ํ๊ธฐ test!
- 2
- 6
- 606




