테스트 사이트 - 개발 중인 베타 버전입니다

마우스 클릭시 효과음 나오고 마우스에 서클 퍼지는 효과 재미 있네요..

· 2년 전 · 1470

질답에 올라온것 오류 수정하고 적용해 보니 재미 있어서 팁자료실에 올립니다.

[code]

<audio id='audio_play' src='/click.mp3'></audio>
<style type="text/css">
    div.clickEffect{
        position:fixed;
        box-sizing:border-box;
        border-style:solid;
        border-color:#000000;
        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.5rem;
        }
        100%{
            opacity:0.2;
            width:15em; height:15em;
            margin:-7.5em;
            border-width:0.03rem;
        }
    }
</style>
<script type="text/javascript">
    $(document).ready(function() {
      $("body").attr("onclick", "play()");
    });

    function play() {
      var audio = document.getElementById('audio_play');
      if (audio.paused) {
         audio.play();
      } else {
         audio.pause();
         audio.currentTime = 0;
      }
    }

    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);
</script>

[/code]

효과음 다운로드 
https://record-ay.tistory.com/32
 

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

게시글 목록

번호 제목
3530
3529
3497
3472
3471
3451
3442
3441
3437
3436
3425
3421
3420
3405
3402
3399
3397
3394
3393
3392
3391
3390
3389
3388
3387
3386
3385
3384
3383
3382