Jacob Windsor
Jacob Windsor

Reputation: 6980

jQuery slider UI not sliding

I'm using the jQuery slider UI for a slider in an audio player only the sliding function doesn't work when I set variables to it.

$('.body_container .slider').slider({

  value: 0,
  step: 0.01,
  orientation: "horizontal",
  range: "min",
  max: song.duration,
  animate: true,  

  slide: function(event,ui) {             
    manualSeek = true;
  },
  stop:function(event,ui) {
    manualSeek = false;         
    song.currentTime = ui.value;
  }
});

In firebug it comes up with the error closestHandle is undefined. closestHandle comesout of the jQuery UI file.

However it does work when I set no options in the function and just leave the events but obviously I need to set the options;

$('.body_container .slider').slider({

  slide: function(event,ui) {             
    manualSeek = true;
  },
  stop:function(event,ui) {
    manualSeek = false;         
    song.currentTime = ui.value;
  }
});

Upvotes: 2

Views: 4050

Answers (2)

CyclingFreak
CyclingFreak

Reputation: 1625

A little late, but make sure that song.duration is a number. You can use parseFloat() to be sure.

Upvotes: 9

3dgoo
3dgoo

Reputation: 15794

I think song.duration is not defined.

Try removing the following line:

max: song.duration,

or replacing it with this:

max: 100,

If it is song.duration that is not working, try using console.log(song.duration); with firebug to debug what is in that variable.

Upvotes: 1

Related Questions