Skip to content

Extends the functionaility of the Chosen plugin by Harvest to display inline images in dropdown menus

License

Notifications You must be signed in to change notification settings

djgrant/chosen-image

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chosen Image frozen

New contributions will not be accepted but for the sake of people still using this script I am leaving it around for the time being. There are no doubt much better ways to do the same thing but, that said, if you would like to continue development feel free to fork or request ownership of the repo. Or choose a library that does this already.

Extends the functionaility of the Chosen plugin by Harvest to display inline images in dropdown menus

View Example

Usage

Add attribute data-img-src to <option> items with the source of your image file.

<select data-placeholder="Choose a Project..." class="my-select" style="width:350px;" tabindex="2">
  <option data-img-src="chosenImage/flag-red.gif">Project A</option> 
  <option>Project B</option> 
</select>

Use chosenImage() in place of chosen() passing in the same properties:

$(".my-select").chosenImage({
  disable_search_threshold: 10 
});

All properties of chosen() are available through chosenImage()

By default images are resized to 19px tall in chosenImage.css

Dependencies

  • jQuery 1.4+
  • Chosen

About

Extends the functionaility of the Chosen plugin by Harvest to display inline images in dropdown menus

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 71.4%
  • CSS 24.7%
  • HTML 3.9%