Giter VIP home page Giter VIP logo

bvselect-jquery's Introduction

BVSelect - JQuery


This plugin replaces native select elements with fully customizable dropdowns.

Even though this replaces native select options, you can still use Form Submit, Onchange Events and Attributes as you would with normal usage.

Demo:

https://bmsvieira.github.io/BVSelect/

VanillaJS Version:

https://github.com/BMSVieira/BVSelect-VanillaJS

Features:

  • ๐Ÿ”ง Fully Customizable
  • ๐Ÿ’ช Lightweight Plugin (5KB Zip)
  • ๐ŸŒŽ Tested in All Modern Browsers (IE11 Included)
  • ๐Ÿ˜Ž Images & FontIcons
  • โŒจ๏ธ Normal Usage (Multiple Selection included)
  • ๐Ÿ”Ž Built-in Searchbox
  • ๐Ÿ–ฅ Prevented Viewport Overflow

Installation:

1 - Include jQuery Plugin.

<script src="path/to/jquery.js"></script> 
<script src="path/to/bvselect.js"></script>

2 - Include Plugin Styles.

<link rel="stylesheet" href="path/to/bvselect.css">

4 - Set HTML.

<select id="selectbox">
  <option data-separator="true"> Select Option </option>
  <option value="1"> Option 1 </option>
  <option value="2"> Option 2 </option>
  <option value="3" disabled> Option 3 </option>
  <option value="4"> Option 4 </option>
</select>

3 - Initilize Plugin.

$(document).ready(function() {
  $('#selectbox').BVSelect();
});

Methods:

Destroy:

$('#selectbox').BVSelect("destroy");

Removes dropdown, unbinds all its events and brings back the original Select

Update:

$('#selectbox').BVSelect("update");

Updates current dropdown based on changes to the original selectbox.

Get ID:

$('#selectbox').BVSelect("getid");

Returns the ID that was generated to build dropdown, so you can add custom classes.

Settings:

Name Value Default Description
width px or % 100% Specify the width of the main element
searchbox true or false false Add a search box to the list
offset true or false true Fixes Viewport Offset

Example:

$(document).ready(function() {
  $('#selectbox').BVSelect({
      width: "33%",
      searchbox: false,
      offset: true,   
  });
});

Attributes:

Name Value Description
data-separator true or false Highlights an option
data-img Image Source Adds an Image to option
data-icon fa fa-hashtag Adds an FontIcon to option, can be used any provider as long it is identical. Images will be prioritized over icons.
disabled (native) disabled Disables an option

To add FontIcons, you must include it's own sources

Example:

<select id="selectbox3">
    <option value="##" data-separator="true" selected>Select Option</option>
    <option data-img="path/to/img.png" value="--">Cristiano Ronaldo</option>
    <option data-icon="fa fa-hashtag" value="--" >Lionel Messi </option>
    <option data-img="path/to/img.png" value="--" disabled>Neymar Jr. (Disabled)</option>
    <option data-img="path/to/img.png" value="--">Ronaldinho</option>
    <option data-img="path/to/img.png" value="--">Luis Figo</option>
</select>

All CSS styles are fully customizable in order to match your style

Frequently Asked Questions

Is there any themes?

It doesn't need themes since the CSS is fully customizable, you are able to change everything to match your style.

In addition to design, what changes?

This plugin replaces the original SelectBox but you can use it as you would with a native one, OnChange Events, Attributes, Form Submit, Append/Remove Options, everything.

What about Browser Compatibility?

It was tested successfully in every modern browser as well as IE 11

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.