Skip to content
This repository was archived by the owner on Feb 26, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions farbtastic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/
(function($) {

var triggerChangeDelay = 200;

$.fn.farbtastic = function (options) {
$.farbtastic(this, options);
return this;
Expand Down Expand Up @@ -190,7 +192,14 @@ $._farbtastic = function (container, callback) {
// Change linked value
$(fb.callback).each(function() {
if (this.value && this.value != fb.color) {
var element = $(this);
this.value = fb.color;
if(fb.triggerChange) {
clearInterval(fb.triggerChange);
}
fb.triggerChange = setTimeout(function() {
element.trigger("change");
}, triggerChangeDelay);
}
});
}
Expand Down