jquery-simple-slider icon indicating copy to clipboard operation
jquery-simple-slider copied to clipboard

Add 'silent' Parameter to setValue and setRatio

Open elsbree opened this issue 11 years ago • 1 comments

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.

elsbree avatar Mar 20 '14 21:03 elsbree

I pulled this into my fork

kamranayub avatar Apr 01 '12 15:04 kamranayub

this is exactly what I was looking for

9mm avatar Apr 12 '12 18:04 9mm

Thanks for this.

I pulled this into my fork and made a small fix to prevent empty tokens from being created.

muscardinus avatar May 02 '12 18:05 muscardinus

Thanks! Pulled in my fork too.

coorasse avatar May 29 '12 06:05 coorasse

This is great, however when you press comma it will add ONE, and only one new entry that doesn't exist in list. Is there something I'm missing? not doing right?, as it seems to work on your website OK- http://www.tomsguide.fr/solutions/nouveau_sujet.htm. On that page you can add as many tags as you want that are new.

earnshaw avatar May 31 '12 15:05 earnshaw

@earnshaw the same thing happened to me. try this: https://github.com/kusmierz/jquery-tokeninput

9mm avatar Jun 01 '12 13:06 9mm

@ecefx - you are an absolute legend! Thank you very much for letting me know about that. Made my day!

earnshaw avatar Jun 01 '12 14:06 earnshaw

This is sweet! Thanks so much!

pbadger avatar Aug 13 '12 20:08 pbadger

This is absolutely epic and thanks a bunch for adding it. However, it should probably be modified to ignore empty strings. Right now in the demo if you type space + comma or space + enter it will result an an empty token being added to the list.

brndnblck avatar Aug 13 '12 21:08 brndnblck

In my code, I have used tokenInput for 4 consecutive text boxes. I have used the token-input.js in https://github.com/kusmierz/jquery-tokeninput

I wish to add a new token when the custom text is pasted using (ctr+v) or by mouse right click and paste. I have added the following code:

$(".container").live("paste", ".token-input-input-token input", function(){ setTimeout(function () { if ( $('.token-input-input-token input').val() != '') { newToken = {'id':$('.token-input-input-token input').val(),'name':$('.token-input-input-token input').val()}; add_token(newToken); return false; } else {
return false;
} }, 100);
}); The code is working fine for the first text box while for other 3 text boxes new token is not created on paste event.

Could you help me to fix the issue?

rupal-pinge avatar Mar 25 '13 13:03 rupal-pinge

will it be great if it works with prevent duplicate with case sensitive or insensitive

rahul100885 avatar Jan 14 '14 14:01 rahul100885

Edit: Fixed on this commit: https://github.com/emir/jquery-tokeninput/commit/ae178c46bf6d3ca9bcbad587dab1137a6d38d554

when I use like below, I got "undefined", do you have any ideas?

$(".skills").tokenInput("/api/v1/skills/find", {
        propertyToSearch: "title",
        theme: "facebook",
        allowCustomEntry : true,
        highlightDuplicates : false,
    });

tokeninput

emir avatar Jul 22 '14 11:07 emir