Deepak
Deepak

Reputation: 1095

I need to slider work with mouse wheel

Please see this URL: http://whipwap.co.uk/shopsense/slider_example/slider_test.html

and code is :

$(document).ready(function(){

$("#content-slider").slider({ mousewheel:true, animate: true, change: handleSliderChange, slide: handleSliderSlide }); });

Now I want to slide with mouse wheel.How I can do this.

Looking for your support.

Thanks,

Deepak

Upvotes: 0

Views: 1906

Answers (1)

Svetlin Panayotov
Svetlin Panayotov

Reputation: 620

In your $(document).read() add this code:

      $("#content-slider").bind('mousewheel', function(event, delta) {
          var newValue = $(this).slider("value");
          var step = $(this).slider("option", "step");
          if (delta > 0)
              newValue += step;
          else
              newValue -= step;
          $(this).slider("value", newValue);
      });

You might want to decrease animation length or clear the queue in handleSliderChange(), because sliding becomes jittery when using the mouse wheel.

Upvotes: 1

Related Questions