问题
I have just discovered Chosen. The library is somewhat large, especially that I am only interested in the "Multiple Select" feature.
Is there a way to build a slimer Chosen
just for "Multiple Select"?
回答1:
Do you mean the facebook like tab completion multiple select type feature? If so ... there are a number of tutorials on line for writing your own. The only way I can imagine you can 'slim down' Chosen is not to! I took a look at the source and it appears to me that the 'multi select' aspect is pretty core to Chosen's functionality. I'm not sure you'd get much out of that route.
If you want to write your own, here is a tutorial you could follow to get write functionality you want:
- How to write a facebook like multiselect
Alternately you could check out some other libraries. I found a couple:
- FCBKcomplete - only 11k!
- Proto!MultiSelect - bigger :(
- jQuery tokenInput - flexible looking.
- TextExtJS - cool kid approved - is it small? dunno.
'Somewhat large' is a subjective term, but to me the 18k sounds pretty slim for the minified version of Chosen. Plus its the one I've used, and have been happy with. However - other libraries abound, so...happy hunting!
来源:https://stackoverflow.com/questions/8774588/chosens-multiple-select