Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Disable mousewheel events Reply To: Disable mousewheel events

#241799
amanda_
Participant

Thank you so much for your response, GMK Hussain. It is working as I hoped to disable the mousescroll.

Here’s my followup question – I just want to temporarily disable the mousewheel function, just during the tween.

I have created a function:

function disable(){
   $('body').bind("mousewheel", function() {
    return false;
});
}

which I run onclick on opening the menu, so the tweens occur, no issues of jumping around.

My logic tells me I should be able to create a function that starts the mousewheel functionality back up again, which I created as such:

function enable(){
   $('body').bind("mousewheel", function() {
    return true;
});
}

I’m them calling this function onComplete of the tweens:

$("#campusButton").click(function() {
   menuClose();
   TweenLite.to($row, 2, {
      y: '-100%',
      x: '0%',
      onComplete:function(){
         tl1.seek('slide2');
         enable();
      }
   });
});

This, alas, does not work. Anything pointing in the right direction would be much appreciated!