๋ฐ์ํ
* ๋ชจ๋ฐ์ผ ๋ฒ์ (ํฐ์คํ ๋ฆฌ๋งํฌ/m)์์๋ ์ ์ฉ๋์ง ์์ต๋๋ค. *
* ์ถ์ฒ : https://fdossena.com/?p=html5cool/clickfx/i.frag *
ํด๋ฆญ์ ๋ง์ฐ์ค์ปค์๋ก๋ถํฐ ๋๊ทธ๋ผ๋ฏธ๊ฐ ํผ์ ธ๋๊ฐ๋ css์ ๋๋ฉ์ด์ ์ ๋๋ค.
์ ๋ ์ง๊ธ ์ฌ์ฉํ๊ณ ์๋๋ฐ ๊ท์ฌ์์ ์ข๋ค์.
์ ๋๋ฉ์ด์ ์๋๋ ๋๊ทธ๋ผ๋ฏธ์ ํฌ๊ธฐ๋ ์กฐ์ ๊ฐ๋ฅํ๋ ์ทจํฅ๋๋ก ์์ ํด์ฃผ๋ฉด ๋ ๋ฏํฉ๋๋ค.
์คํจํธ์ง์ผ๋ก ๋ค์ด๊ฐ์ css์ html์ ์๋์ ์ฝ๋๋ค์ ๋ฃ์ด์ฃผ๋ฉด ๋ฉ๋๋ค.๐
1.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div.clickEffect{ | |
โโposition:fixed; | |
โโbox-sizing:border-box; | |
โโborder-style:solid; | |
โโborder-color:#FFFFFF; | |
โโborder-radius:50%; | |
โโanimation:clickEffect 0.4s ease-out; | |
โโz-index:99999; | |
} | |
@keyframes clickEffect{ | |
โโ0%{ | |
โโโโopacity:1; | |
โโโโwidth:0.5em; height:0.5em; | |
โโโโmargin:-0.25em; | |
โโโโborder-width:0.5em; | |
โโ} | |
โโ100%{ | |
โโโโopacity:0.2; | |
โโโโwidth:15em; height:15em; | |
โโโโmargin:-7.5em; | |
โโโโborder-width:0.03em; | |
โโ} | |
} |
2.html์<script></script>์ฌ์ด์
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clickEffect(e){ | |
โโvar d=document.createElement("div"); | |
โโd.className="clickEffect"; | |
โโd.style.top=e.clientY+"px";d.style.left=e.clientX+"px"; | |
โโdocument.body.appendChild(d); | |
โโd.addEventListener('animationend',function(){d.parentElement.removeChild(d);}.bind(this)); | |
} | |
document.addEventListener('click',clickEffect); |
+์ ๋ ์ด ์์น๊ฐ์ผ๋ก ์ฌ์ฉํ๊ณ ์์ด์.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@keyframes clickEffect{ | |
0%{ | |
opacity:1; | |
width:0.5em; height:0.5em; | |
margin:-0.25em; | |
border-width:0.1rem; | |
} | |
100%{ | |
opacity:0.2; | |
width: 4.0em; height: 4.0em; | |
margin:-2.0em; | |
border-width:0.03rem; | |
} | |
} |
๋ฐ์ํ