javascript - I want that "mousewheel event delay" -


i want that.. mousewheel event delay

example...i run wheeldown..so change "bg_02". change bg_05.. want delay 1 wheeldown , change bg_01 -> bg_02 1 wheeldown , change bg_02 -> bg_03 ... wheeldown change bg_01 -> bg_04 or wheeldown count ++

sorry english little

script

// wheel function wheel(){ if (event.wheeldelta >= 120){     wheelup();     return; } else if (event.wheeldelta <= -120){     wheeldown();  }    }    var bgspot = $('.bg_spot');    var bgspot_cnt = bgspot.length;    bgspot.eq(0).addclass('spot_on').css('top','0');     // down    function wheeldown(i){    $('.spot_on').addclass('move_top');    $('.spot_on').next().css('top','0');    $('.spot_on').next().addclass('spot_on').prev().removeclass('spot_on');    } 

css

.bg_spot{position:fixed;top:100%;right:0;bottom:0;left:0;z-index:10;width:100%;height:100%; -webkit-transition: 0.6s ease; -moz-transition: 0.6s ease; -o-transition: 0.6s ease; transition: 0.6s ease;}  .move_top{ -webkit-transform: translate3d(0,-100%,0); -moz-transform: translate3d(0,-100%,0); -o-transform: translate3d(0,-100%,0); transform: translate3d(0,-100%,0);}  .move_stage{ -webkit-transform: translate3d(0,0,0); -moz-transform: translate3d(0,0,0); -o-transform: translate3d(0,0,0); transform: translate3d(0,0,0);}  .top_0{top:0} .bg_01{background:#ccc;}  .bg_02{background:#000;}  .bg_03{background:olive;}  .bg_04{background:green} 

html

   <body onmousewheel="wheel();">      <div class="bg_spot bg_01">&nbsp;</div>      <div class="bg_spot bg_02">&nbsp;</div>      <div class="bg_spot bg_03">&nbsp;</div>      <div class="bg_spot bg_04">&nbsp;</div>    </body> 

changed css , javascript. check snippet

 function wheel() {       if (event.wheeldelta >= 120) {         //    wheelup();         return;       } else if (event.wheeldelta <= -120) {         wheeldown();         }     }     //        var bgspot = $('.bg_spot');     //        var bgspot_cnt = bgspot.length;     //        bgspot.eq(0).addclass('spot_on').css('top', '0');     // down   var = 1,     j = 0;     function wheeldown() {       $('.bg_spot').hide();         $('.bg_0' + i).show();       // $('.spot_on').addclass('move_top');     // $('.spot_on').next().css('top', '0');     //  $('.spot_on').next().addclass('spot_on').prev().removeclass('spot_on');       i++;     if (i > 4)       = 1;   }
.bg_spot {        overflow: hidden;        position: absolute;        right: 0;        left: 0;        z-index: 10;        width: 100%;        height: 100%;        -webkit-transition: 0.6s ease;        -moz-transition: 0.6s ease;        -o-transition: 0.6s ease;        transition: 0.6s ease;        display: none;      }      .move_top {        -webkit-transform: translate3d(0, -100%, 0);        -moz-transform: translate3d(0, -100%, 0);        -o-transform: translate3d(0, -100%, 0);        transform: translate3d(0, -100%, 0);      }      .move_stage {        -webkit-transform: translate3d(0, 0, 0);        -moz-transform: translate3d(0, 0, 0);        -o-transform: translate3d(0, 0, 0);        transform: translate3d(0, 0, 0);      }      .top_0 {        top: 0      }      .bg_01 {        background: #ccc;      }      .bg_02 {        background: #000;      }      .bg_03 {        background: olive;      }      .bg_04 {        background: green      }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>    <body onmousewheel="wheel();">    <div class="bg_spot bg_01" style="display:block;">      &nbsp;</div>    <div class="bg_spot bg_02">      &nbsp;</div>    <div class="bg_spot bg_03">      &nbsp;</div>    <div class="bg_spot bg_04">      &nbsp;</div>  </body>


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -