loopj / jquery-simple-slider

Unobtrusive numerical slider plugin for jQuery
194 stars 113 forks source link

Add 'silent' Parameter to setValue and setRatio #56

Open elsbree opened 10 years ago

elsbree commented 10 years ago

I'm developing an audio player, and we're using simple-slider to display playback progress and allow users to scrub through the song (click-and-drag to move to a different location in the song).

This means that we have to update the position of the slider by using the setRatio method whenever the playback position of the song changes (every tenth of a second or so when playing audio). However, to enable scrubbing we also have to listen to the 'slider:changed' event so that we can update the playback position when the user drags the slider.

The problem then becomes that every time we call setRatio on the slider to update the playback position, the slider fires the 'slider:changed' event and triggers the listener which tries to update the playback position again- this goes on ad infinitum.

It would be nice to have a 'silent' parameter in the setValue and setRatio methods which prevents the 'slider:changed' event from firing. I've already written one, and I'd be happy to submit a PR if this is something you think would be useful.

lukasz-madon commented 10 years ago

:+1: