Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 952933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:58:15+00:00 2026-05-15T23:58:15+00:00

I’ve been struggling with this for a little while now.. I am using this

  • 0

I’ve been struggling with this for a little while now.. I am using this code to monitor the mousewheel so it can be used for scrolling with a slider that I have.. however, it has an issue where the actions queue up so if you scroll with the mousewheel fast (like anyone would do normally) they build up and it causes buggy behavior.. I know about handling this sort of issue with animation, but not with a mousewheel monitor..

I want to do something like unbind the mousewheel at the start of the action (in this case, to scroll the scrollbar after mousewheel is moved) then rebind it after this, so if user does too many scrolls too fast it just ignores until the initial scroll is completed.. I tried the code below but its not rebinding so I’m not sure what I am doing wrong, any advice is appreciated.

        $("#wavetextcontainer").bind("mousewheel", function(event, delta) {

   //HERE IS WHERE EVENT IS UNBOUND:
     $("#wavetextcontainer").unbind("mousewheel");

        var speed = 10;
        var mySlider = $("#slider");
        var sliderVal = mySlider.slider("option", "value");

        sliderVal += (delta*speed);

        if (sliderVal > mySlider.slider("option", "max")) sliderVal = mySlider.slider("option", "max");
        else if (sliderVal < mySlider.slider("option", "min")) sliderVal = mySlider.slider("option", "min");

        $("#slider").slider("value", sliderVal);

        event.preventDefault();

      // HERE I WANT TO REBIND THE EVENT:
     $("#wavetextcontainer").bind("mousewheel");

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:58:16+00:00Added an answer on May 15, 2026 at 11:58 pm

    You need to store the function were you can reference it, like this:

    function myHandler(event, delta) {
         $("#wavetextcontainer").unbind("mousewheel", myHandler);
    
            var speed = 10;
            var mySlider = $("#slider");
            var sliderVal = mySlider.slider("option", "value");
    
            sliderVal += (delta*speed);
    
            if (sliderVal > mySlider.slider("option", "max")) sliderVal = mySlider.slider("option", "max");
            else if (sliderVal < mySlider.slider("option", "min")) sliderVal = mySlider.slider("option", "min");
    
            $("#slider").slider("value", sliderVal);
    
            event.preventDefault();
    
          // HERE I WANT TO REBIND THE EVENT:
         $("#wavetextcontainer").bind("mousewheel", myHandler);    
    };
    
    $("#wavetextcontainer").bind("mousewheel", myHandler);
    

    By doing this you can call .bind() later to the same function (you can’t reference an anonymous one). You’re currently trying to call .bind() without a function to handle anything, which doesn’t work. This also has the added advantage of being able to pass that same function reference to .unbind() so it unbinds only that handler, not any mousewheel handler.


    Alternatively, do this without un/re-binding, like this:

    $("#wavetextcontainer").bind("mousewheel", function (event, delta) {
      event.preventDefault();
      if($.data(this, 'processing')) return; //we're processing, ignore event
    
      $.data(this, 'processing', true);
      var speed = 10;
      var mySlider = $("#slider");
      var sliderVal = mySlider.slider("option", "value");
    
      sliderVal += (delta*speed);
    
      if (sliderVal > mySlider.slider("option", "max")) sliderVal = mySlider.slider("option", "max");
      else if (sliderVal < mySlider.slider("option", "min")) sliderVal = mySlider.slider("option", "min");
    
      $("#slider").slider("value", sliderVal);
      $.data(this, 'processing', false);
    });
    

    This just uses $.data() to store a “we’re working” data entry with the element, if anything hits this handler while it’s true, it just returns and ignores the event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.