当前位置:JS特效 » 其他 » Bootstrap 4 select下拉框功能扩展和美化jquery插件
 Bootstrap 4 select下拉框功能扩展和美化jquery插件
如果您觉得内容不错,请分享:

插件介绍

这是一款Bootstrap4select下拉框功能扩展和美化jquery插件。该插件扩展了Bootstrap4原生select下拉框的功能,可以进行多选,带搜索框等,并且对Bootstrap4原生select下拉框进行了样式美化。

浏览器兼容性

浏览器兼容性
时间:2021-07-24 阅读:46
简要教程

这是一款Bootstrap 4 select下拉框功能扩展和美化jquery插件。该插件扩展了Bootstrap 4原生select下拉框的功能,可以进行多选,带搜索框等,并且对Bootstrap 4原生select下拉框进行了样式美化。

安装

可以通过npm来安装该jquery插件。

npm i --save bootstrap-hardskilled-extend-select                  
                

使用方法

在页面中引入jquery,bootstrap4相关文件,以及select.min.css和select.min.js文件。





    
                
HTML结构

一个最基本的bootstrap select下拉框的HTML结构如下:


                
初始化插件

在页面DOM原生加载完毕之后,通过下面的方法来初始化该bootstrap4 select下拉框插件

$('select').extendSelect({
    // Search input placeholder:
    search: 'Find',
    // Title if option not selected:
    notSelectedTitle: 'Pls select',
    // Message if select list empty:
    empty: 'Empty',
    // Class to active element
    activeClass: 'active',
    // Class to disabled element
    disabledClass: 'disabled',
    // Custom error message for all selects (use placeholder %items)
    maxOptionMessage: 'Max %items elements',
    // Delay to hide message
    maxOptionMessageDelay: 2000,
    // Popover logic (resize or save height)
    popoverResize: true,
    // Auto resize dropdown by button width
    dropdownResize: true
});               
                

该Bootstrap 4 select下拉框功能扩展和美化jquery插件的github地址为:https://github.com/hardskilled/bootstrap-hardskilled-extend-select

Top