左右选择框 js插件
随着项目的进展,测试工程师在更多的浏览器中兼容性测试中,发现有些浏览器不支持option的触发事件,这就造成了先前一篇博文bootstrap 左右框多项选择示例
中左右选择框的失效,于是我就由原先的select-option结构 改成了 现在的 ul-li 结构,并写成了js插件的形式,方便以后调用和修改,并在多个浏览器测试中得到验证:
实现的页面如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4UAAAFVCAIAAADXE93xAAAgAElEQVR4nO3d71Mb953Acf9PPPD02T253GQ6eeA5J5fp5Zpp3PiSa6e5piUh1HHSuzr2mbRx4vzo9JorGIMMAYRDDBhisLGNSSwwGBC2hSR+S0JCIIGEtD/vwYatkIQsVgu7gvdrvvOZIIFYJTPfeWclLUdUAAAAwDpHrD4AAAAAHGr0KAAAAKxEjwIAAMBK9CgAAACsRI8CAADASvQoAAAArESPAgAAwEo79qiSQQYAAAD2Rp4eVRTFCwAAAOyLPD0qy7LX61UUJZFIrK+vJxKJjY0NJpPJZDKZTCZzL2Z2jyqKIkmS1+u1w8ExmUwmk8lkMg/8zNOjoih6vd719fUNAAAAYI/t2KNWHxgAAAAOhaecH2UymUwmk8lkMvd0HsmKUVmWBUHQzo9afnBMJpPJZDKZzAM/d+zRdQAAAGDv0aMAAACw0o49GgcAAAD2Hj0KAAAAK+3Yo7FYLB6PM5lMJpPJZDKZezoLnR+1/OCYTCaTyWQymQd+Fjo/CgAAAOw1ehQAAABW2rFH19bWYrHYns6amhqHw2HsZ0Oh0FtvvXXr1q3C39nR0fHpp59GIhH9lsXFxdOnT9+9e3evnx2TyWQymUwms5hZ6Pxo8Q8UCoU++eSTx48fa7dEIpH//u///vrrr9fW1mpqampqavL+lNaja2trDoejYgdZPxsMBi9cuHD9+vVgMPjWW2/dvHkzFot9++23H3zwgc/ny3r8cDh8+vTptrY27ZarV69evHhxeXn57Nmz586dy4xUJpPJZDKZTKZVc8ceXV1dXVtbK3Kurq46HI7q6upAILC2tjY5OfnSSy8NDw+vbfVo3p+qqalpbGzU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p7Llh2vOoACAXPQoApbLnhmnPowKAXPQoAJTKnhumPY8KAHLRowBQKntumPY8KgDIRY8CQKnsuWHa86gAIBc9CgClsueGac+jAoBc9CgAlMqeG6Y9jwoActGjAFAqe26Y9jwqAMhFjwJAqey5YdrzqAAg15GsrxVFEUXRCwAAAOyLPD0qSZLVRwUAAIDDIrtHVVXVXrJPpVKbW5IAAADA3sjTo9q7SCVJErcIAAAAwN7I06N6lepkAAAAYG/s2KMAAADAPqBHAQAAYKX/B7CdN8Z+i87QAAAAAElFTkSuQmCC" alt="" />
jsp页面的修改如下:
<div id="province_dchannel">
<div class="panel panel-default">
<!-- Default panel contents -->
<div class="panel-heading">选择省份</div>
<fieldset>
<table class="table table-bordered dchannel-table">
<tbody>
<tr class="item-default">
<td align="right">
<div class="has-feedback">
<label class="control-label sr-only" for="search_province_repo"></label>
<input type="text" class="form-control search-for-select phone1" id="search_province_repo" placeholder="Search" forselect="sel_all_area" />
<span class="glyphicon glyphicon-search form-control-feedback" style="height:40px;line-height:40px;margin-right:-10px;"></span>
<div style="padding-top:8px;">
<%-- <select id="sel_all_area" multiple="multiple" size="10" style="width:100%;height:222px;">
<c:forEach items="${unselectedAreas}" var="area" varStatus="loop">
<option value="${area.code}">${area.name}(${area.code})</option>
</c:forEach>
</select> --%>
<ul id="sel_all_area" style="width:100%;height:222px;border-radius:0px;overflow-y: scroll;padding-left:10px;text-align:left;">
<c:forEach items="${unselectedAreas}" var="area" varStatus="loop">
<li class="proxy_li" data="${area.code}">${area.name}(${area.code})</li>
</c:forEach>
</ul>
</div>
</div> </td>
<td style="width: 50px;" valign="middle">
<div style="padding-top:38px;">
<button type="button" class="btn btn-default btn-small gr" id="btn_select_all_area"><span class="glyphicon glyphicon-forward"></span></button>
<button type="button" class="btn btn-default btn-small gr" id="btn_choose_selected_area"><span class="glyphicon glyphicon-chevron-right"></span></button>
<button type="button" class="btn btn-default btn-small gr" id="btn_remove_selected_area"><span class="glyphicon glyphicon-chevron-left"></span></button>
<button type="button" class="btn btn-default btn-small gr" id="btn_remove_all_area"><span class="glyphicon glyphicon-backward"></span></button>
</div>
</td>
<td style="width: 45%;">
<div class="has-feedback">
<label class="control-label sr-only" for="search_province_select"></label>
<input type="text" class="form-control search-for-select phone1" id="search_province_select" placeholder="Search" forselect="sel_selected_areas">
<span class="glyphicon glyphicon-search form-control-feedback" style="height:40px;line-height:40px;margin-right:-10px;"></span></input>
<div style="padding-top:8px;">
<%-- <select id="sel_selected_areas" multiple="multiple" size="10" style="width:100%;height:222px;">
<c:forEach items="${selectedAreas}" var="area" varStatus="loop">
<option value="${area.code}">${area.name}(${area.code})</option>
</c:forEach>
</select> --%>
<ul id="sel_selected_areas" style="width:100%;height:222px;border-radius:0px;overflow-y: scroll;padding-left:10px;text-align:left;">
<c:forEach items="${selectedAreas}" var="area" varStatus="loop">
<li class="proxy_li" data="${area.code}">${area.name}(${area.code})</li>
</c:forEach>
</ul>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</fieldset>
</div>
下面是调用插件的代码
$(function () {
$.selectBox({
ulFrom: 'sel_all_area',
ulTo: 'sel_selected_areas',
selectAll: 'btn_select_all_area',
selectSelected: 'btn_choose_selected_area',
removeAll: 'btn_remove_all_area',
removeSelected: 'btn_remove_selected_area',
selectedClass: 'selected',
quickQuery: 'search-for-select'
});
});
最后直接贴出缩写插件的代码:
/**
* 智能左右选择框插件
* @param sel_all_from 资源选择框
* @param sel_all_to 目标选择框
* @remark 由于select-option组合造成某些浏览器不支持option事件,所以此插件采用ul-li组合来模拟完成选择</br>经测试,支持firefox,chrome,ie6+,360,猎豹等主流浏览器
* @date 2015-1-13
* @author wjq1255
*
*/
(function ($) {
$.selectBox = function (options) {
var defaults = {
ulFrom: 'ul_all_from',
ulTo: 'ul_all_to',
selectAll: 'btn_select_all',
selectSelected: 'btn_select_selected',
removeAll: 'btn_remove_all',
removeSelected: 'btn_remove_selected',
selectedClass: 'selected',
quickQuery:''
};
//init
var option = $.extend(defaults, options);
var j_all_from = $("#"+option.ulFrom),
j_selected_to = $("#"+option.ulTo); var b_select_all = $("#"+option.selectAll),
b_select_selected = $("#"+option.selectSelected),
b_remove_all = $("#"+option.removeAll),
b_remove_selected = $("#"+option.removeSelected);
//快速搜索选择匹配
var quickQuery = function(){
var b_quick_query = $("input."+option.quickQuery);
b_quick_query.keyup(function(){
var select = $(this).attr("forselect");
var keyvalue = $(this).val();
$("#" + select).find("li").each(function(){
if($(this).html().indexOf(keyvalue) >= 0 || !keyvalue){
$(this).show();
}else{
$(this).hide();
}
});
return false;
});
} if(option.quickQuery != ''){//设定快速搜索选择匹配
quickQuery();
} b_select_all.click(function(){//全选按钮
j_all_from.find("li").each(function(){
$(this).appendTo(j_selected_to);
});
return false;
});
b_select_selected.click(function(){//单选按钮
j_all_from.find("li.selected").each(function(){
$(this).appendTo(j_selected_to);
});
return false;
});
b_remove_selected.click(function(){//单选返回按钮
j_selected_to.find("li.selected").each(function(){
$(this).appendTo(j_all_from);
});
return false;
});
b_remove_all.click(function(){//全选返回按钮
j_selected_to.find("li").each(function(){
$(this).appendTo(j_all_from);
});
return false;
}); j_all_from.find("li").on("click", function(event){
event = event || window.event;
//单击选中,按住Ctrl键实现多选,否则,单选
if(event.ctrlKey){
$(this).toggleClass("selected");
}else{
$(this).toggleClass("selected").siblings("li.selected").removeClass("selected");
}
return false;
});
j_selected_to.find("li").on("click", function(event){
event = event || window.event;
//单击选中,按住Ctrl键实现多选,否则,单选
if(event.ctrlKey){
$(this).toggleClass("selected");
}else{
$(this).toggleClass("selected").siblings("li.selected").removeClass("selected");
}
return false;
});
//双击选择选项
j_all_from.find("li").on("dblclick", function(){
$(this).addClass("selected");
if ($(this).parent("ul").is(j_all_from)) {
b_select_selected.click();
}
else {
b_remove_selected.click();
}
return false;
});
//双击返回选项
j_selected_to.find("li").on("dblclick", function(){
$(this).addClass("selected");
if ($(this).parent("ul").is(j_selected_to)) {
b_select_selected.click();
}
else {
b_remove_selected.click();
}
return false;
});
};
})(jQuery);
左右选择框 js插件的更多相关文章
- jquery.chosen.js下拉选择框美化插件项目实例
由于之前使用的bootstrap-select插件是建立在bootstrap基础上的,实际使用到项目中的时候,与我们使用的ace-admin(基于bootstrap)存在样式冲突,导致下拉框的样式发生 ...
- [jQueryUI] – Chosen:select下拉选择框美化插件及问题
Chosen 是一个支持jquery的select下拉框美化插件,它能让丑陋的.很长的select选择框变的更好看.更方便.不仅如此,它更扩展了select,增加了自动筛选的功能.它可对列表进行分组, ...
- 基于jQuery美化联动下拉选择框
今天给大家介绍一款基于jQuery美化联动下拉选择框.这款下下拉选择框js里自带了全国所有城市的数数库.下拉选择框适用浏览器:IE8.360.FireFox.Chrome.Safari.Opera.傲 ...
- 使select文本框可编辑可选择(jQuery插件)
最近做项目中用到了这个插件,正好分享下. 1. 需要用的js包点击下载,在项目中引入该js. <script src="${pageContext.request.contextPa ...
- FancySelect – 更好用的 jQuery 下拉选择框插件
FancySelect 这款插件是 Web 开发中下拉框功能的一个更好的选择.FancySelect 使用方便,只要绑定页面上的任何 Select 元素,并调用就 .fancySelect() 就可以 ...
- 前端插件之Bootstrap Switch 选择框开关控制
简介 Bootstrap Switch是一款轻量级插件,可以给选择框设置类似于开关的样式 它是依赖于Bootstrap的一款插件 下载 下载地址 在线引用 导入 因为它是依赖于Bootstrap的一款 ...
- 使用bootstrap的JS插件实现模态框效果
在上一篇文章中,我们使用 js+css 实现了模态框效果,在理解了模态框的基本实现方法和实现效果后,我们就要寻找更快捷的方法,又快又好的来完成模态框开发需求,从而节约时间,提高效率.一个好的轮子,不仅 ...
- jQuery插件——下拉选择框
其实,之前也写过jQuery插件,今天写的是一个模拟select选择的下拉插件. 既然是jQuery插件,那么必然是依赖jQuery的了. 老规矩,直接上代码吧! ;(function () { $. ...
- Highchar.js插件提示框千分位显示为空格而不是逗号 --(2018 08/06-08/12周总结)
1.Oracle在已经存在主键的表中插入复合主键的SQL语句 如已有一个表test_key,其中a1列为主键. CREATE TABLE TEST_KEY( A1 VARCHAR2(3) NOT NU ...
随机推荐
- C++ 错误积累
错误一 VS2012错误:不能在成员函数 的类外部重新声明该函数 解决:检查函数的大括号匹配
- H - Coins
H - Coins Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Descripti ...
- visual studio code (vscode)像 sublime text 的 ctrl+d 一样多光标选中
快捷键是 ctrl+m ,返回上一个选中时ctrl+u. 文件 ==>首选项 ==>键盘快捷键() 里面可以查到,下一个是“将选择添加到下一个查找匹配项”,返回上一个是“cursorund ...
- wxwidget自定义消息处理步骤
from http://www.cppblog.com/kenlistian/archive/2009/02/06/73096.html 略有修改 wxwidget自定义消息处理步骤 自定义消息处理( ...
- 网站存储session的方案
1: ASP.NET State Service是什么 用来管理 Session 的,正常来说,Session 位于IIS进程中(其实可以理解成在服务器的内存中),当IIS重启或程序池回收会自动清空S ...
- Numerical Differentiation 数值微分
zh.wikipedia.org/wiki/數值微分 数值微分是数值方法中的名词,是用函数的值及其他已知资讯来估计一函数导数的算法. http://mathworld.wolfram.com/Nume ...
- They're much closer in spirit to how our brains work than feedforward networks.
http://neuralnetworksanddeeplearning.com/chap1.html Up to now, we've been discussing neural networks ...
- JVM指令重排
指令重排的基本原则: a.程序顺序原则:一个线程内保证语义的串行性 b.volatile规则:volatile变量的写,先发生于读 c.锁规则:解锁(unlock)必然发生在随后的加锁(lock)前 ...
- Windows命令行(DOS命令)教程
一.命令行简介 命令行就是在Windows操作系统中打开DOS窗口,以字符串的形式执行Windows管理程序. 在这里,先解释什么是DOS? DOS——Disk Operation System 磁盘 ...
- Caffe学习系列(三)Docker安装及一些问题的记录
前言: Docker安装倒是很简单,按照步骤轻松完成,但是在联网方面还是出现问题,大概是伟大的祖国防火墙将其拦下,但在开发中要遇山开山,见水搭桥.在其中我将解决方法记录下来,每次解决了困难想分享找不到 ...