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

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

· 2년 전 · 1473

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

[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
 

댓글 작성

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

로그인하기

게시글 목록

번호 제목
3293
3292
3291
3290
3289
3288
3286
3285
3284
3282
3281
3280
3279
3278
3277
3276
3275
3274
3273
3272
3271
3270
3269
3268
3267
3266
3265
3263
3262
3261