websemantics / Image-Select

Image Select is an extension of Chosen, a jQuery plugin that makes long, unwieldy select boxes much more user-friendly. It provides image support for Single and Multi select HTML tags.
http://websemantics.github.io/Image-Select
MIT License
147 stars 44 forks source link

Show Initial Selection Image #8

Closed quickstick closed 9 years ago

quickstick commented 9 years ago

Hi guys,

Thanks for a great plugin. I noticed that if you have an option preselected as the page is loaded, the image isn't shown, until you open and close the dropdown.

My solution was to add:

$this.trigger('chosen:hiding_dropdown');

To line 167 of ImageSelect.jquery.js - after the chosen:showing_dropdown event is added.

It didn't work if I had it in the chosen:ready event (unless I delayed it by 1 second (so the other events could load)), but you might be able to find a better home for it.

I probably haven't covered all the bases for testing, but it seems happy enough on both single and multiple selects - hope it helps.

Last thing, in case it matters, your README says v1.1, but the ImageSelect.jquery.js says v1.0.2.

Thanks again.

websemantics commented 9 years ago

I've added your suggestion to the plugin and it seems have addressed the problem, thanks for that