Git Product home page Git Product logo

quickselect's Introduction

QuickSelect

A Quick replacement for the good old Select tags.

Why I built this plugin?

This should be useful if you need to style some select box, without having extra headaches to worry about.

I hope you like this!

Why should you use this instead of another plugin?

  • 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.

Optional parameters

QuickSelect supports optional parameters.

iconUp

The icon that will be displayed when the dropdown is visible.
Default: "▲"

iconDown

The icon that will be displayed when the dropdown is not visible.
Default: "▼"

minElemsBeforeGoingUp

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

openEffect

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);
	}
});

closeEffect

Default: "hide"

Same as above, but this is the effect used when the dropdown closes.

How to Use

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>'
});

IE Support

I haven't tested this on IE, but should work from IE8 and up. I'll update this later.

TO-DOs

  • Support for multiple enabled selectors.
  • Support for optgroups.

License

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!

quickselect's People

Contributors

msaggiorato avatar

Watchers

James Cloos avatar  avatar

quickselect's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.