dan_vitch
dan_vitch

Reputation: 4559

Slider change event firing on slider build

I am using jquery slider. I set a function to be on called on slider change.

The problem I have it the function is being called when the slider is initially built. I dont want the change function to fire on event build. Just on change.

here is my code

$('.sliderClass').slider({
    range: true,
    step: 5,
    values: [0, 5],
    min: 0,
    max: 100,
    change: function (e, ui) {
        myFunction(e, ui);
    }
});

var myFunction = function (e, ui){
    //do stuff
};

this code is being called on document ready.

Upvotes: 1

Views: 121

Answers (1)

dan_vitch
dan_vitch

Reputation: 4559

I figure it out using this link

http://forum.jquery.com/topic/slider-event-originalevent

$('.sliderClass').slider({
  change: function(e, ui) {
  if(e.originalEvent==undefined) {

    } else {
        myFunction(e, ui);
    }
}});

Upvotes: 1

Related Questions