210410 JavaScript jQuery MouseWheel 연습

ITisIT210·2021년 4월 12일
0

jQuery

목록 보기
39/142
post-thumbnail
<!DOCTYPE html>
<html lang="en">
    <head>
            <meta charset="UTF-8">
            <title>Document</title>
    </head>
    <boby>

        <script src="js/jquery-3.6.0.min.js"></script> 
        <script src="js/jquery-ui.min.js"></script>
        <script src="js/jquery.mousewheel.min.js"></script>
        
        <script>
            // mousewheel -> 마우스 휠 입력이 이벤트
            $(window).on("mousewheel", function (e, d) { //매개변수는 2개
                console.log(d);
                if (d > 0) { // d가 1일 때
                    console.log("up!");
                } else if (d < 0) { // d가 -1일 때
                    console.log("down!");
                }
            });
        </script>
    </boby>
    </html>
profile
Engineering is the closest thing to magic that exists in the world.

0개의 댓글