관리 메뉴

moozi

jQuery mouseWheel 이벤트 본문

TIS_2018/응용sw2018_1기

jQuery mouseWheel 이벤트

moozi 2018. 4. 10. 11:47

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>Document</title>

    <script

  src="https://code.jquery.com/jquery-1.12.4.min.js"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js"></script>

    <script>

        $(function(){

             $('body').mousewheel(function(event,delta){

                  if(delta>0){ // 마우스 휠을 올렸을때

                      console.log("up");

                      $("#box2").removeClass("up"); 

                        

                  }else if(delta<0){//내렸을때

                      console.log("down");

                       $("#box2").addClass("up"); 

                  }

             });

            });

 


    </script>

    <style>

        *{margin: 0;padding: 0;}

        #box1{

            width:100%;

            height: 100%;

            position: fixed;

            background-color: red;

           

        }

        #box2{

            width:100%;

            height: 100%;

            background-color: blue;

            position: fixed;

            

            top:100%;   

            transition:2s;

        }

        .up{

            top:0% !important;

        }

    </style>

</head>

<body>

    <div id="box1">box1</div>

    <div id="box2">box2</div>

</body>

</html>

'TIS_2018 > 응용sw2018_1기' 카테고리의 다른 글

jQuery연습문제  (0) 2018.04.10
transition timing function  (0) 2018.04.10
Oracle Explain Plan  (0) 2018.04.09
4/6 gallery01.html  (0) 2018.04.06
jQuery연습문제01  (0) 2018.04.06
Comments