A Quick replacement for the good old Select tags.
This should be useful if you need to style some select box, without having extra headaches to worry about.
I hope you like this!
- I try to keep this as lightweight and fast as possible. It's only around 4KB minified.
- It's also responsive.
- It works with events tied to the original select box.
- It let's you stylize almost the entire selectbox layout.
- It key navigable, just like the standard select tag.
QuickSelect supports optional parameters.
The icon that will be displayed when the dropdown is visible.
Default: "▲"
The icon that will be displayed when the dropdown is not visible.
Default: "▼"
This is the minimun number of options to display below the select box before trying to display it above the box. (You'll get this better if you play with it yourself.) Default: 3
Default: "fadeIn"
This parameter allows you to override the effect used when the dropdown opens. If you want it to slide, just set this parameter to something like this.
$('#myCoolSelect').QuickSelect({
openEffect: function(){
$(this).slideDown(100);
}
});
Default: "hide"
Same as above, but this is the effect used when the dropdown closes.
If you don't want to write any extra JS code, just add the quick-select class to your select box, and the plugin will automatically initialize.
If you have something like this in your HTML.
<select id="myCoolSelect" name="data">
<option value="1">This is an option</option>
<option value="2">And this is another</option>
<option value="3">Here comes the boom</option>
<option value="4">Kaboom!</option>
</select>
Just do this with jQuery and you'll be good to go.
$('#myCoolSelect').QuickSelect();
Maybe using some FontAwesome icons as an option?
$('#myCoolSelect').QuickSelect({
iconDown: '<i class="icon-collapse"></i>',
iconUp:'<i class="icon-collapse-top"></i>'
});
I haven't tested this on IE, but should work from IE8 and up. I'll update this later.
- Support for multiple enabled selectors.
- Support for optgroups.
The MIT License (MIT) Copyright (c) 2014 Matias Saggiorato.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
It means, you can freely fork and modify this project for commercial or non-comercial use!