BVSelect - Jquery Plugin for SelectBoxes

栏目: IT技术 · 发布时间: 4年前

内容简介:This plugin replaces native select elements with fully customizable dropdowns.Even though this replaces native select options, you can still use

BVSelect - Jquery Plugin

BVSelect - Jquery Plugin for SelectBoxes

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/

Features:

  • :wrench: Fully Customizable
  • :muscle: Lightweight Plugin (5KB Zip)
  • :earth_americas: Tested in All Modern Browsers (IE11 Included)
  • :sunglasses: Images & FontIcons
  • ⌨️ Normal Usage (Multiple Selection included)
  • :mag_right: 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


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

编程原本

编程原本

Alexander Stepanov、Paul McJones / 裘宗燕 / 机械工业出版社华章公司 / 2012-1-10 / 59.00元

本书提供了有关编程的一种与众不同的理解。其主旨是,实际的编程也应像其他科学和工程领域一样基于坚实的数学基础。本书展示了在实际编程语言(如C++)中实现的算法如何在最一般的数学背景中操作。例如,如何定义快速求幂算法,使之能使用任何可交换运算。使用抽象算法将能得到更高效、可靠、安全和经济的软件。 这不是一本很容易读的书,它也不是能提升你的编程技能的秘诀和技巧汇编。本书的价值是更根本性的,其终极目......一起来看看 《编程原本》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

MD5 加密
MD5 加密

MD5 加密工具