转载:http://code.google.com/p/sexy-combo/
Sexy Combo is a jQuery plugin that replaces drop downs with a more usable and style-able version then the browser default. The plugin offers:
This project has stopped active development , but a fork of sexy-combo is in active development by one of the authors. See UFD; the Unobtrusive Fast-filter Dropdown , especially this UFD WhyTheFork wiki-page .
Please follow these instructions to install Sexy Combo:
<script
type
=
"text/javascript"
src
=
"path_to_plugin/lib/jquery-1.3.2.js"
></script>
<script
type
=
"text/javascript"
src
=
"path_to_plugin/lib/jquery.sexy-combo-2.1.2.js"
></script>
// core structure
<
link rel
=
"stylesheet"
type
=
"text/css"
href
=
"path_to_plugin/lib/sexy-combo.css"
/>
//sexy skin; substitute different skin here if desired
<
link rel
=
"stylesheet"
type
=
"text/css"
href
=
"path_to_plugin/skins/sexy/sexy.css"
>
Sexy Combo has a number of configuration options that are passed to the plugin in the form of JavaScript object, e.g. $("select").sexyCombo({triggerSelected: true}); . The full list of options is:
Note that all callback functions are called in the scope of sexyCombo instance, so you have access to all of its methids / properties.
It is possible to create multiple comboboxes from which users can choose more than one option. All you need is to set "multiple" attribute of your selectbox to true, or set multiple autoFill config option. It will be fixed in one of the futute releases. config option to true if you create combo without selectbox. Currently this option does not work with
You are also able to create combos without using existing selectboxes. If you want to do this, you should use static method of jQuery.sexyCombo object named create , for example:
$
.
sexyCombo
.
create
({
id
:
"id"
,
name
:
"name"
,
container
:
"#container"
,
data
:
[
{
value
:
"1"
,
text
:
"First option"
,
selected
:
true
},
{
value
:
"2"
,
text
:
"Second option"
},
{
value
:
"3"
,
text
:
"Third option"
}
]
});
Below is the list of configuration options for static creating of comboboxes. You can pass them to the create method together with options we have discussed above.
In this version I have separated core CSS and presentational CSS, so now it's possible to create new skins for Sexy Combo . The download package contains one example skin. Feel free to create your own based on it.
Sexy Combo has been tested and works on the following browsers:
The developers welcome bug reports on any browser bug. Patches or code suggestions are also welcome.
Every user of Sexy Combo adds some value to it, so you help me by just using it. However, if you want to help more, you can do the following: