jq 穿梭框

#HTML代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">

</head>
<body>

<div class="ty-transfer mt20 ml20" id="ued-transfer-1">
    <div class="fl ty-transfer-list transfer-list-left">
        <div class="ty-transfer-list-head">
            地域列表
        </div>
        
        <div class="ty-transfer-list-body">
            <ul class="ty-tree-select">
                <li>
                    <div class="ty-tree-div">
                        <label class="tyue-checkbox-wrapper">
                            <span class="tyue-checkbox">
                                <input type="checkbox" class="tyue-checkbox-input" id="tyue-checkbox-blue">
                                <span class="tyue-checkbox-circle">
                                </span>
                            </span>
                            <span class="tyue-checkbox-txt" title="穿梭框列表内容 ---- 1">
                                穿梭框列表内容 ---- 1
                            </span>
                        </label>
                    </div>
                </li>
                <li>
                    <div class="ty-tree-div">
                        <label class="tyue-checkbox-wrapper">
                            <span class="tyue-checkbox">
                                <input type="checkbox" class="tyue-checkbox-input" id="tyue-checkbox-blue">
                                <span class="tyue-checkbox-circle">
                                </span>
                            </span>
                            <span class="tyue-checkbox-txt" title="穿梭框列表内容 ---- 2">
                                穿梭框列表内容 ---- 2
                            </span>
                        </label>
                    </div>
                </li>
                <li>
                    <div class="ty-tree-div">
                        <label class="tyue-checkbox-wrapper">
                            <span class="tyue-checkbox">
                                <input type="checkbox" class="tyue-checkbox-input" id="tyue-checkbox-blue">
                                <span class="tyue-checkbox-circle">
                                </span>
                            </span>
                            <span class="tyue-checkbox-txt" title="穿梭框列表内容穿梭框列表内容 ---- 3">
                                穿梭框列表内容 ---- 3
                            </span>
                        </label>
                    </div>
                </li>
                <li>
                    <div class="ty-tree-div">
                        <label class="tyue-checkbox-wrapper">
                            <span class="tyue-checkbox">
                                <input type="checkbox" class="tyue-checkbox-input" id="tyue-checkbox-blue">
                                <span class="tyue-checkbox-circle">
                                </span>
                            </span>
                            <span class="tyue-checkbox-txt" title="穿梭框列表内容---- 4">
                                穿梭框列表内容 ---- 4
                            </span>
                        </label>
                    </div>
                </li>
                
            </ul>
        </div>
        <div class="ty-transfer-list-foot">
            <div class="ty-tree-div">
                <div class="tyc-check-blue fl">
                    <input type="checkbox" class="transfer-all-check" id="tyc-check-blue">
                    <span>
                    </span>
                </div>
                <div class="ty-tree-text">
                    全选
                </div>
            </div>
        </div>
    </div>
    <div class="fl ty-transfer-operation">
        <span class="ty-transfer-btn-toright to-switch">
        </span>
        <span class="ty-transfer-btn-toleft to-switch">
        </span>
    </div>
    <div class="fl ty-transfer-list transfer-list-right">
        <div class="ty-transfer-list-head">
            地域列表
        </div>
        <div class="ty-transfer-list-body">
            <ul class="ty-tree-select">
                <li>
                    <div class="ty-tree-div">
                        <label class="tyue-checkbox-wrapper">
                            <span class="tyue-checkbox">
                                <input type="checkbox" class="tyue-checkbox-input" id="tyue-checkbox-blue">
                                <span class="tyue-checkbox-circle">
                                </span>
                            </span>
                            <span class="tyue-checkbox-txt" title="穿梭框列表内容 ---- 7">
                                穿梭框列表内容 ---- 5
                            </span>
                        </label>
                    </div>
                </li>
                <li>
                    <div class="ty-tree-div">
                        <label class="tyue-checkbox-wrapper">
                            <span class="tyue-checkbox">
                                <input type="checkbox" class="tyue-checkbox-input" id="tyue-checkbox-blue">
                                <span class="tyue-checkbox-circle">
                                </span>
                            </span>
                            <span class="tyue-checkbox-txt" title="穿梭框列表内容 ---- 8">
                                穿梭框列表内容 ---- 5
                            </span>
                        </label>
                    </div>
                </li>
                <li>
                    <div class="ty-tree-div">
                        <label class="tyue-checkbox-wrapper">
                            <span class="tyue-checkbox">
                                <input type="checkbox" class="tyue-checkbox-input" id="tyue-checkbox-blue">
                                <span class="tyue-checkbox-circle">
                                </span>
                            </span>
                            <span class="tyue-checkbox-txt" title="穿梭框内容穿梭框内容穿梭框内容 ---- 9">
                               穿梭框列表内容 ---- 7
                            </span>
                        </label>
                    </div>
                </li>
                <li>
                    <div class="ty-tree-div">
                        <label class="tyue-checkbox-wrapper">
                            <span class="tyue-checkbox">
                                <input type="checkbox" class="tyue-checkbox-input" id="tyue-checkbox-blue">
                                <span class="tyue-checkbox-circle">
                                </span>
                            </span>
                            <span class="tyue-checkbox-txt" title="穿梭框列表内容穿梭框列表内容 ---- 10">
                                穿梭框列表内容......
                            </span>
                        </label>
                    </div>
                </li>
            </ul>
        </div>
        <div class="ty-transfer-list-foot">
            <div class="ty-tree-div">
                <div class="tyc-check-blue fl">
                    <input type="checkbox" class="transfer-all-check" id="tyc-check-blue">
                    <span>
                    </span>
                </div>
                <div class="ty-tree-text">
                    全选
                </div>
            </div>
        </div>
    </div>
    <div class="clearboth">
    </div>
            
</div>
        
<!--过滤筛选 end-->

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="Transfer.js"></script>
<script type="text/javascript">
	$("#ued-transfer-1").transferItem();
</script>
	
<div style="text-align:center;">
<p>来源:<a href="http://www.mycodes.net/" target="_blank">源码之家</a></p>
</div>

</body>
</html>

#css代码

@charset "utf-8";
img{border:0;vertical-align:middle;max-width:100%;} 
body {
    font-size: 12px;
    font-family: 'PingFang SC','Hiragino Sans GB','PingHei','Open Sans','sans-serif','Helvetica Neue','Helvetica','Microsoft YaHei','SimSun','Arial';
    color: #666666;
}
html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,input,textarea,p,table,tr,th,td,span,strong,em{padding:0;margin:0;font-style:normal;font-size:12px;}
input{
    border:0;
   padding: 0px;
   font-size: 12px;
   background: none;
   font-family: "PingFang SC", "Hiragino Sans GB", "PingHei", "Open Sans", "sans-serif", "Helvetica Neue","Helvetica", "Microsoft YaHei", "SimSun", "Arial";
}
input:-webkit-autofill, 
 textarea:-webkit-autofill, 
 select:-webkit-autofill { 
        background-color: #fff;
       -webkit-box-shadow: 0 0 0 1000px white inset; 
}
input[type=text]:focus, input[type=password]:focus, textarea:focus {
    /*background-color: #fff;
      -webkit-box-shadow: 0 0 0 1000px white inset;*/ 
}
button, button:focus, button:active ,button:link{
    -webkit-appearance:none;
    outline:none;
}
ol,ul,li{list-style:none;} 
h1,h2,h3,h4,h5,h6{font-weight:normal;font-size:100%;}   
table{border-collapse: collapse;border-spacing: 0;}
a{text-decoration:none;outline:none;cursor: pointer;color: #333;}
a:link,a:visited{text-decoration:none;}
a:hover{text-decoration:none;}
a:active{text-decoration:none;} 
.clearboth{clear:both;}
.fl{float:left;}
.fr{float:right;}
.ml5{margin-left:5px;}
.mt20{margin-top:13px;}
.mt50{margin-top:20px;}
.mt10{margin-top:10px;}
.ml20{margin-left:20px;}
.div-h,.ty-p{line-height:1.5;}
.color9{color:#999;}
.color-blue{color:#00a0e8;}
.p16{padding:16px;}
.p24{padding:24px;} 
.bgf7{padding:10px;background:#f7f7f7;}
.bg999{padding:10px;background:#999;}
.ty-relative{position:relative;}

@charset "utf-8";

.tyue-checkbox{
   vertical-align: middle;
   display: inline-block;
   position: relative;
   white-space: nowrap;
}
.tyue-checkbox-txt{margin-left: 6px;margin-right: 8px;}

/*过滤*/
.ty-transfer-list{width:200px;height:350px;border:1px solid #d9d9d9;border-radius:3px;background:#fff;}
.ty-transfer-list-head{height:32px;line-height:32px;text-align:center;font-size:14px;color:#666;font-weight: bold;}
.ty-transfer-list-serach{width:auto;padding:0 15px 8px;position:relative;}
.ty-transfer-list-serach input{display:block;width:100%;height:28px;line-height:28px;padding-left:30px;border:1px solid #ccc;border-radius:4px;box-sizing:border-box;}

.ty-transfer-list-serach input{
     transition: all .3s linear;
     -webkit-transition: all .3s linear;
     -o-transition: all .3s linear;
     -moz-transition: all .3s linear;
}
.ty-transfer-list-serach>input:focus,
.ty-transfer-list-serach>input:hover{
     border-color: #57c5f7;
     border: 1px solid #57c5f7;
     outline: 0;
     box-shadow: 0 0 0 2px rgba(45,183,245,.2);
}


.ty-transfer-list-serach-icon{ width:17px;height:17px;display:block;position:absolute;top:4px;left:22px;z-index:10;}
.ty-transfer-list-body{border-top:1px solid #d9d9d9;padding:4px 10px;height:285px;overflow-y:auto;box-sizing:border-box;}
.ty-transfer .ty-tree-arrow-right span,.ty-transfer .ty-tree-arrow-bottom span{margin-left:0;}
.ty-transfer .ty-tree-select-ul{padding-left:38px;}
.ty-transfer .ty-tree-div .tyc-check-blue{margin:8px 6px;}
.ty-transfer .ty-tree-div{height:30px;}
.ty-transfer .ty-tree-text{height:30px;line-height:30px;line-height:30px; cursor: pointer;}
.ty-transfer .ty-tree-switcher{height:28px;}
.ty-transfer-list-foot{background:#f1f1f1;}
.ty-transfer-list-serach+.ty-transfer-list-body{height:230px;}
.ty-transfer-operation{padding:107px 20px 0 40px;}
.ty-transfer-operation span{
    display:block;
    width:43px;
    height:28px;
    text-align: center;
    position: relative;
    cursor:pointer;
    border:1px solid #d9d9d9;
    border-radius:4px;
    background-image:url("ue-icon-little.png");
    background-repeat: no-repeat;
    background-color:#f3f3f3;
    transition: background-color 0.3s linear;
    -moz-transition: background-color 0.3s linear;
    -webkit-transition: background-color 0.3s linear;
    -o-transition: background-color 0.3s linear;

}

.ty-transfer-operation span i{
    font-size: 2em;
    color: #bbb;
}
.ty-transfer-operation span+span{margin-top:25px;}
.ty-transfer-operation span:hover{border:1px solid #3dadf2;background-color:#7AC7F8;}
.ty-transfer-operation span:hover i{
    color:#fff;
}
.ty-transfer-btn-toright,.ty-transfer-btn-toright.disabled:hover{background-position:17px -150px;}

.ty-transfer-btn-toright:hover,.ty-transfer-btn-toright.active,.ty-transfer-btn-toright.active:hover{background-position:17px -175px; }

.ty-transfer-btn-toleft,.ty-transfer-btn-toleft.disabled:hover{background-position:17px -206px;}
.ty-transfer-btn-toleft:hover,.ty-transfer-btn-toleft.active,.ty-transfer-btn-toleft.active:hover{background-position:17px -231px;}
.ty-transfer-operation span.active{border:1px solid #3dadf2;background-color:#00A0E8;}
.ty-transfer-operation span.active i{color: #fff;}
.ty-transfer-btn-toleft.disabled:hover,.ty-transfer-btn-toright.disabled:hover{cursor: not-allowed;border:1px solid #d9d9d9;;background-color:#f3f3f3;}

.ty-transfer-operation .active:hover{
    background-color: #7AC7F8;
}

.show .ty-tabs{width:460px;}
.ty-tabs-nav{height:38px;border-bottom:2px solid #d9d9d9;position:relative;}
.ty-tabs-nav>div{height:40px;overflow:hidden;position:relative;}
.ty-tabs-nav-scroll>div{width:auto;margin:0 40px;}
.ty-tabs-ul{width:100%;height:38px;position:absolute;top:0;left:0;z-index:10;}
.tabs-nav-scroll-ul{width: 1300px;}
.ty-tabs-ul li{float:left;padding:0 15px;height:38px;line-height:38px;font-size:14px;color:#666;cursor:pointer;}
.ty-tabs-ul li.current{color:#00a0e8;}
.ty-tabs-icon-prev,.ty-tabs-icon-next{width:38px;height:38px;display:block;border-bottom:2px solid #d9d9d9;cursor:pointer;position:absolute;top:0;z-index:100;}
.ty-tabs-icon-prev{background-position:15px -368px;left:0;}
.ty-tabs-icon-prev:hover{background-position:15px -396px;}
.ty-tabs-icon-next{background-position:15px -424px;right:0;}
.ty-tabs-icon-next:hover{background-position:15px -454px;}
.ty-tabs-line{width:86px;height:2px;background:#00a0e8;position:absolute;bottom:-2px;left:0;z-index:101;}
.ty-tabs-nav-scroll .ty-tabs-line{left:40px;}
.show .ty-tabs-card{width:460px;}
.ty-tabs-card-nav{height:32px;position:relative;}
.ty-tabs-card-nav>div{height:32px;position:relative;}
.ty-tabs-card-nav-scroll>div{width:auto;margin:0 40px;}
.ty-tabs-card-ul{width:100%;height:32px;position:absolute;top:1px;left:0;z-index:10;}
.ty-tabs-card-ul li{float:left;min-width:48px;height:30px;line-height:30px;text-align:center;padding:0 15px;font-size:12px;color:#666;border:1px solid #f1f1f1;border-bottom:0;background:#f1f1f1;border-radius:4px 4px 0 0;cursor:pointer;}
.ty-tabs-card-ul li+li{margin-left:8px;}
.ty-tabs-card-ul li.current{color:#00a0e8;border:1px solid #d9d9d9;border-bottom:1px solid #fff;background:#fff;}
.ty-tabs-card-con{border:1px solid #d9d9d9;}

.tabbox{width:100%;height:140px;margin:auto;}
.tabbox .content{overflow:hidden;width:auto;height:auto;position:relative;}
.tabbox .content ul{position:relative;left:0;top:0;height:auto;}
.tabbox .content li{width:1500px;height:auto;float:left; padding: 50px;}
.tabbox .content li p{padding:10px;}
 /*.ty-tabs-card-con{height:100px;padding-top:80px;}*/
 .ty-tabs-card-con>.mt20{text-align:center;}
.ty-tabs-card .ty-tabs-icon-prev,.ty-tabs-card .ty-tabs-icon-next{width:32px;height:32px;display:block;border-bottom:0;cursor:pointer;position:absolute;top:0;z-index:100;}
.ty-tabs-card .ty-tabs-icon-prev{background-position:15px -371px;left:0;}
.ty-tabs-card .ty-tabs-icon-prev:hover{background-position:15px -399px;}
.ty-tabs-card .ty-tabs-icon-next{background-position:15px -427px;right:0;}
.ty-tabs-card .ty-tabs-icon-next:hover{background-position:15px -457px;}
.ty-breadcrumb{height:24px;}
.ty-breadcrumb li{float:left;height:24px;line-height:24px;font-size:14px;color:#999;}
.ty-breadcrumb span{padding:0 10px;color:#ccc;font-size:14px;}
.ty-breadcrumb a{color:#666;font-size:14px;}
.ty-breadcrumb a:hover{text-decoration:none;color:#00a0e8;}
.ty-breadcrumb a:hover{font-weight:bold;}
.ty-breadcrumb a.current:hover{color: #666;font-weight:bold;cursor: default;}
.ty-breadcrumb a.current{font-weight:bold;}
/*  分页 start */
.ty-page{height:20px;padding:3px 0;}
.ty-page li{float:left;}
.ty-page li+li{margin-left:8px;height:20px;}
.ty-page a{height:20px;line-height:20px;padding:0 6px;color:#333;}
.ty-page a:hover{color:#00a0e8;text-decoration:none;}
.ty-page a.current,.ty-page a.current:hover{color:#fff;border-radius:4px;background:#00a0e8;}
.ty-page li.focus,.ty-page li.focus:hover{color:#fff;border-radius:4px;background:#00a0e8;}
.ty-page li.focus a{color:#fff;}
.ty-page .ty-page-prev,.ty-page .ty-page-next{color:#666;}
.ty-page .ty-page-prev:hover,.ty-page .ty-page-next:hover{color:#00a0e8;}
.ty-page .ty-page-prev-disabled,.ty-page .ty-page-next-disabled{cursor:default;color:#ccc;}
.ty-page .ty-page-prev-disabled:hover,.ty-page .ty-page-next-disabled:hover{color:#ccc;background:transparent;}
.ty-page .ty-page-options{width:90px;height:24px;border:1px solid #ccc;border-radius:4px;position:relative;}
.ty-page-options.current{border:2px solid #d5f1fd;top:-1px;}
.ty-page-options p{width:auto;margin:0 25px 0 12px;height:24px;line-height:24px;position:relative;}
.ty-page-options-icon{width:20px;height:20px;display:block;position:absolute;top:2px;right:-20px;}
.ty-page-options-icon02{width:20px;height:20px;display:block;background:url(../images/ue-icon-little.png) no-repeat left -20px;position:absolute;top:2px;right:-20px;}
.ty-page-options ul{width:100%;background:#fff;border-radius:4px;border:1px solid #ccc;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.25);border:1px solid #e5e5e5;overflow:hidden;position:absolute;top:30px;left:0;z-index:100;}
.ty-page-options li{
    cursor:pointer;
    text-indent:12px;
    color:#666;
    width: 100%;   
}
.ty-page-options li:hover{background:#f0f9ff;}
.ty-page-options .ui-select-pagesize{display: none}
.ty-page-options li.current{background:#f5f5f5;}
.ty-page-jumper{height:26px;}
.ty-page-jumper span{display:block;height:26px;line-height:26px;float:left;}
.ty-page-jumper input{display:block;height:24px;line-height:24px;padding:0 10px;width:20px;border-radius:4px;border:1px solid #ccc;color:#666;float:left;margin:0 10px;}
.ty-page02{height:26px;}
.ty-page02 span{display:block;height:26px;line-height:26px;color:#333;}
.ty-page02 input+span{margin-right:10px;}
/*.ty-page02 input{width:30px;height:24px;line-height:24px;text-align:center;border:1px solid #ccc;border-radius:4px;margin:0 13px 0 5px;}*/
.ty-page02-prev,.ty-page02-next{width:20px;height:26px;line-height:26px;text-align:center;cursor:pointer;color:#666;float:left;margin-left:5px;}
.ty-page02-prev:hover,.ty-page02-next:hover{color:#00a0e8;}

/*20161013分页样式修改*/
/*分页调整*/
.ty-page li.ui-pager {
    cursor: pointer;
}
.ty-page .ui-pager-disabled, .ty-page .ui-pager-disabled:hover {
    cursor: not-allowed;
    color: #ccc;
    background: transparent;
}
.ty-page .ui-select-pagesize>li{
    height:32px;
    line-height:32px;
    margin: 0;
}
.ty-page .js-page-action{margin-top: 4px}
.ty-page-jumper input{
     transition: all .3s linear;
     -webkit-transition: all .3s linear;
     -o-transition: all .3s linear;
     -moz-transition: all .3s linear;
}
.ty-page-jumper>input:focus,
.ty-page-jumper>input:hover{
     border-color: #57c5f7;
     border: 1px solid #57c5f7;
     outline: 0;
     box-shadow: 0 0 0 2px rgba(45,183,245,.2);
}
.ty-page-options{
    cursor: pointer;
    transition: all .3s linear;
    -webkit-transition: all .3s linear;
    -o-transition: all .3s linear;
    -moz-transition: all .3s linear;
}
.ty-page-options.current{
     border: 1px solid #57c5f7;
     top: 0;
     outline: 0;
     box-shadow: 0 0 0 2px rgba(45,183,245,.2);
    }
.ty-page .ty-page-prev, .ty-page .ty-page-next{
    font-size: 12px;
    outline:none;
    cursor: pointer;
    border: 0;
    background: transparent;
    font-weight: normal;
    padding: 0;
    font-family: 'PingFang SC','Hiragino Sans GB','PingHei','Open Sans','sans-serif','Helvetica Neue','Helvetica','Microsoft YaHei','SimSun','Arial';
}
.ty-page .ty-page-prev-disabled,
.ty-page .ty-page-next-disabled{
    cursor: not-allowed;
}
/* 分页 end*/

/**20161014 tree按钮**/

/**未选中禁用**/
.tyc-check-disabled span{
     background:#f3f3f3;
     width: 10px;
     height: 10px;
     display: block;
     border: 1px solid #d8d8d8;
     position: absolute;
     top: 0;
     left: 0;
     z-index: 2;
}
/**选中禁用**/
/*.tyc-check-disabled span:after{
    content: "";
    width: 10px;
    height: 10px;
    display: block;
    border: 1px solid #d8d8d8;
    display: block;
    background: url(../images/table-icon.png) no-repeat 0 -410px #f3f3f3;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    display: none;
}*/
.tyc-check-checkall span{
    width: 10px;
    height: 10px;
    display: block;
    border: 1px solid #d8d8d8;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
   
}
/**未选全**/
.tyc-check-incomplete span{
    width: 12px;
    height: 12px;
    border: 0;
    display: block;
    position: absolute;
    top: -1px;
    left: -1px;
    z-index: 2;
}

/**展开**/
.tyc-check-expand span{
    width: 12px;
    height: 12px;
    border: 0;
    display: block;
    position: absolute;
    top: -1px;
    left: -1px;
    z-index: 2;
}



#js代码

(function($){


  $.fn.transferItem = function(options){
        function transferItem($this,options){
            this.init($this,options)
        }

        transferItem.prototype = {
            init: function($this,options){
                this.el = $this;
                this.ops = options;
                this.transferAllCheck = this.el.find(".transfer-all-check");
                this.switchBtn = this.el.find(".to-switch");
                this.allCheckedBoxes = this.el.find(".tyue-checkbox-input");
                this.alldivBoxes = this.el.find(".ty-tree-div");
                
                this.checkBoxEvent();
                this.allCheckEvent();
                this.switchEvent();
                this.checkBoxesDbClick();
                time = null;
            },
            //按钮切换事件
            switchEvent : function(){
                var that = this;
                this.switchBtn.on("click",function(){
                    that.transferAllCheck.removeAttr("checked","checked");
                    var _this = $(this);
                    
                    var a_tagClass = null;
                    if(_this.hasClass("ty-transfer-btn-toright")){
                        findCheckbox = _this.parents(".ty-transfer").find(".transfer-list-left li");
                        inputCheckbox = _this.parents(".ty-transfer").find(".transfer-list-right ul");
                        a_tagClass = "ty-transfer-btn-toright";
                    }else{
                        findCheckbox = _this.parents(".ty-transfer").find(".transfer-list-right li");
                        inputCheckbox = _this.parents(".ty-transfer").find(".transfer-list-left ul");
                        a_tagClass = "ty-transfer-btn-toleft";
                    }
                    
                    var checkBox = findCheckbox.find(":checked");
                        if(checkBox != 0){
                            var arrVal = [];
                            checkBox.each(function(){
                                $(this).removeAttr("checked");
                                var appendText = $(this).parents(".ty-tree-div").parent("li");                         
                                arrVal.push(appendText);
                                that.removeActiveEvent(a_tagClass,"active");
                                that.addActiveEvent(a_tagClass,"disabled");                      
                            });
                            inputCheckbox.prepend(arrVal);
                      }

                })
            },

            //所有标签单击选中事件
            checkBoxEvent : function(){
                var that = this;
                this.allCheckedBoxes.on("click",function(){
                    clearTimeout(time);
                    time = setTimeout(function(){
                        var classNames = that.checkTagClass($(this));
                        if($(this).is(":checked")){           
                            that.removeActiveEvent(classNames[0],"disabled");
                            that.addActiveEvent(classNames[0],"active");
                            if(!$("."+classNames[1]).hasClass("active")){
                                that.addActiveEvent(classNames[1],"disabled");
                             } 
                        }else{
                            var siblingsTag = $(this).parents(".ty-tree-div").parent("li").siblings("li").find(".tyue-checkbox-input");
                            if(!siblingsTag.is(":checked")){
                                that.removeActiveEvent(classNames[0],"active");
                                that.addActiveEvent(classNames[0],"disabled");
                                $(this).parents(".ty-transfer").find(".transfer-all-check").removeAttr("checked","checked")
                            }
                        }
                    }.bind(this),200);

                });     
            },

               //所有按钮双击事件
            checkBoxesDbClick : function(){
                var that = this;

                this.alldivBoxes.bind("dblclick",function(event){
                    var _this = $(this);
                    $(this).removeAttr("checked");

                    if(_this.parents(".ty-transfer-list").hasClass("transfer-list-left")){
                        inputCheckbox = _this.parents(".ty-transfer").find(".transfer-list-right ul");
                        btnCheckbox = that.el.find(".ty-transfer-btn-toright");
                    }else{
                        inputCheckbox = _this.parents(".ty-transfer").find(".transfer-list-left ul");
                        btnCheckbox = that.el.find(".ty-transfer-btn-toleft");
                    }
        
                    var siblingsTag = _this.parent("li").siblings("li").find(".tyue-checkbox-input");
                    if(!siblingsTag.is(":checked")){
                        btnCheckbox.removeClass("active");
                    }
                    

                    var appendText = _this.parent("li");

                    

                    inputCheckbox.prepend(appendText);
                    appendText.find(".tyue-checkbox-input").removeAttr("checked");
                    
                });
            },
           
            //全选按钮事件
            allCheckEvent : function(){
                var that = this;
                this.transferAllCheck.on("click",function(){
                    var checkBoxs = $(this).parents(".ty-transfer-list-foot").siblings(".ty-transfer-list-body").find(":checkBox");
                    
                    var classNames = that.checkTagClass($(this));

                    if($(this).prop("checked") == true){
                        checkBoxs.attr("checked","checked");
                        that.removeActiveEvent(classNames[0],"disabled");
                        that.addActiveEvent(classNames[0],"active");
                        if(!$("."+classNames[1]).hasClass("active")){
                            that.addActiveEvent(classNames[1],"disabled");
                         }               
                    }else{
                        checkBoxs.removeAttr("checked","checked");
                        that.removeActiveEvent(classNames[0],"active");
                        that.addActiveEvent(classNames[0],"disabled");
                    }
                })
            },
            //按钮添加class事件
            checkTagClass : function($that){
                var parentsTransfer = $that.parents(".ty-transfer-list");
                    var tagClass = null;
                    var tagRemoveClass = null;

                    if(parentsTransfer.hasClass("transfer-list-left")){
                        tagClass = "ty-transfer-btn-toright"
                        tagRemoveClass = "ty-transfer-btn-toleft";
                    }else{
                        tagClass = "ty-transfer-btn-toleft"
                        tagRemoveClass = "ty-transfer-btn-toright";
                    }
                    return [tagClass,tagRemoveClass];
            },
            addActiveEvent : function(position,addClasses){
                this.el.find("."+position).addClass(addClasses);
            },
            removeActiveEvent : function(position,addClasses){
                this.el.find("."+position).removeClass(addClasses);
            },

        }

        new transferItem(this,options)
  }

  /*
    * 穿梭框 end
    */



})(jQuery);
//-----------------------------此处jquery 插件 结束 下面为免调用全局方法---------------------------------
jQuery(document).ready(function($) {

  
    /*
     * 自定义列的功能////////////////////////////////////////////////////////////////////////////////
     * */

   
    /*
    * 按钮点击 start
    * */

    $(".btn").click(function(){
        //主按钮点击后 样式
        var _this = $(this);
        _this.addClass("ued-btn-clicked");
        setTimeout(function(){
             _this.removeClass("ued-btn-clicked");
         },300);
        /*if($(this).hasClass("main-btn-active")){
            $(this).css("background","#7AC7F8")
        }else if($(this).hasClass("secondary-btn-active")){
        
        }*/
        //判断是否有自定义属性改变文本
        if($.type($(this).attr('data-text')) != "undefined")
        {
            var datatext = $(this).attr("data-text");
            $(this).text(datatext);
        }
    });
});




猜你喜欢

转载自blog.csdn.net/weixin_42575028/article/details/86610739
jq