Unbind mousewheel event and bind it again
I'm using the jquery-mousewheel.js plugin, and I'd like to decide, if user scrolls down, then the content should fade out, and the user should see the next section. During this event, a class changing, and the event should stop, and only the next scroll down should fire it again (bind/unbind). I think I should use an event handler, but I don't know how to implement it in my code. I've tried the code below but its not working, any advice is appreciated.
-
- $('body').bind('mousewheel', function(event, delta) {
- if (delta> 0){
- return false;
- } else{
- hidewithfade();
- if ($("#next-screen").hasClass("homelink")){
- shownews();
- showwithfade();// Hide home, show news
- $("#next-screen").removeClass();
- $("#next-screen").addClass("newslink");
- $( 'body' ).unbind( "mousewheel" );
- } else
- if ($("#next-screen").hasClass("newslink")){
- $( 'body' ).bind( "mousewheel" ); // This should rebind it, but doesn't work
- shownews(); // Hide news, show chapters
- showwithfade();
- $("#next-screen").removeClass();
- $("#next-screen").addClass("chapterslink");
-
- }
- }
- });
-