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

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

· 2년 전 · 1462

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

[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
 

댓글 작성

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

로그인하기

게시글 목록

번호 제목
3810
3809
3808
3806
3805
3804
3799
3798
3796
3795
3794
3790
3784
3779
3776
3775
3774
3767
3765
3761
3752
3748
3734
3730
3723
3719
3706
3686
3656
3655