淘宝商品jQuery列表多条件查询(含有多选和全部)

<!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>淘宝商品jQuery列表多条件查询特效代码_其它代码_JS代码_一流资源网 </title>
<meta name="keywords" content="jQuery列表多条件查询特效代码" />
<meta name="description" content="一款仿淘宝购物的商品列表页面多条件查询筛选商品种类特效代码。"/>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font:12px/180% Arial, Helvetica, sans-serif, "新宋体";}
/* select */
.select{padding:5px 10px;border:#ddd 1px solid;border-radius:4px;width:60%;margin:5% auto;font-size:12px}
.select li{list-style:none;padding:10px 0 5px 100px}
.select .select-list{border-bottom:#eee 1px dashed}
.select dl{zoom:1;position:relative;line-height:24px;}
.select dl:after{content:" ";display:block;clear:both;height:0;overflow:hidden}
.select dt{width:100px;margin-bottom:5px;position:absolute;top:0;left:-100px;text-align:right;color:#666;height:24px;line-height:24px}
.select dd{float:left;display:inline;margin:0 0 5px 5px;}
.select dd a{display:inline-block;white-space:nowrap;height:24px;padding:0 10px;text-decoration:none;color:#039;border-radius:2px;}
.select dd a:hover{color:#f60;background-color:#f3edc2}
.select .selected a{color:#fff;background-color:#f60}
.select-result dt{font-weight:bold}
.select-no{color:#999}
.select .select-result a{padding-right:20px;color:#fff;background:#f60 url("close.gif") right 9px no-repeat}
.select .select-result a:hover{background-position:right -15px}

</style>
</head>

<body>

<div align="center">

<!--/////////////////////////////////////////////////////////////////////////-->

<ul class="select">
<li class="select-list">
<dl id="select1">
<dt>上装:</dt>
<dd class="select-all selected"><a href="#">全部</a></dd>
<dd class="acti" date-type="1"><a href="#">针织衫</a></dd>
<dd class="acti" date-type="2"><a href="#">毛呢外套</a></dd>
<dd class="acti" date-type="3"><a href="#">T恤</a></dd>
<dd class="acti" date-type="4"><a href="#">羽绒服</a></dd>
<dd class="acti" date-type="5"><a href="#">棉衣</a></dd>
<dd class="acti" date-type="6"><a href="#">卫衣</a></dd>
<dd class="acti" date-type="7"><a href="#">风衣</a></dd>
</dl>
</li>
<li class="select-result">
<dl>
<dt>已选条件:</dt>
<dd class="select-no">暂时没有选择过滤条件</dd>
</dl>
</li>
</ul>

<!--/////////////////////////////////////////////////////////////////////////-->

</div>

</body>
</html>
<script type="text/javascript">
$(document).ready(function(){


$("#select1 dd.acti").click(function(){

var type=$(this).attr("date-type");
var copyThisA = $(this).clone();
if($(this).hasClass('selected')){
$(".select-result dd[date-type='"+type+"']").hide();
}
else{
$(this).siblings('.select-all').removeClass('selected');
$(".select-result dl").append(copyThisA);
}
$(this).toggleClass('selected');
})

$(".select-result").delegate("dd","click",function(){
var type=$(this).attr("date-type");
$(this).hide();
$("#select1 dd[date-type='"+type+"']").removeClass('selected');
if(!$("#select1 dd").hasClass("selected")){
$("#select1 .select-all").addClass("selected");
}
})

$(".select dd").live("click", function () {
if ($("#select1 .select-all").hasClass("selected") || !$("#select1 dd").hasClass("selected")) {
$("#select1 .select-all").addClass("selected");
$(".select-no").show();
} else{
$(".select-no").hide();
}
});

});


</script>

posted @ 2017-04-09 16:49  天--安静  阅读(949)  评论(0编辑  收藏  举报