diff --git a/ImageSelect.jquery.js b/ImageSelect.jquery.js index f2b5860..2d8b8ad 100644 --- a/ImageSelect.jquery.js +++ b/ImageSelect.jquery.js @@ -67,6 +67,9 @@ } } + $this.on('chosen:filter', function(){ + $this.trigger('chosen:showing_dropdown'); + }); }); }); @@ -155,6 +158,12 @@ for(var i = 0; i < lis.length; i++){ var li = lis[i]; var option = options[i]; + + var idx = $(li).attr('data-option-array-index'); + if (idx){ + option = chosen.form_field.options[chosen.results_data[idx].options_index]; + } + var img_src = $(option).attr('data-img-src'); if(img_src != undefined){ @@ -164,9 +173,11 @@ } }); }); - $this.trigger('chosen:hiding_dropdown'); + this.each(function() { + $(this).trigger('chosen:hiding_dropdown'); + }); return ret; } }); -})(jQuery); \ No newline at end of file +})(jQuery);