javascript - Enable scroll within a function -


when use scrollwheel i'm incremeting currentslide one, when currentslide === 2 red div going , want enable scrolling body. see bind function returning false. tried put conditions on , return true when currentslide === 2 apparently won't work.

can explain me how fix that?

var currentslide = 0;  function scrolldown() {     console.log('scroll down', currentslide);          if(currentslide < 3) {     currentslide += 1;                    }    if(currentslide === 3) {     $('#el').addclass('hide');   } } 

http://jsbin.com/rovicawija/1/edit?js,console,output

i'm totally not sure trying question , expected result quite unclear

i made code following

var currentslide = 0;      function scrolldown() {         console.log('scroll down', currentslide);              if(currentslide < 10) {         currentslide += 1;                          return false;       }        if(currentslide === 10) {         $('#el').addclass('hide');       }     }       $(window).on('dommousescroll', function(e) {             if (e.originalevent.detail > 0) {                 return scrolldown();             }            })         .on('mousewheel', function(e) {              if (e.originalevent.wheeldelta < 0) {                 return scrolldown();             }          }); 

by using on(which should) , having scrolldown returning boolean false if not go, , return nothing if there's nothing do.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -