按价格排序的小三角图标替换效果jquery
2014-08-13来源:

html代码:

<div class="price" title="点击按价格从高到低排序">按价格排序<span class="price_asc"></span></div>

jquery代码:

$(".price").click(function(){

 $(this).children("span").toggleClass("price_desc");

})

$(".price").toggle(function(){$(this).attr("title","点击按价格从低到高排序");},function(){$(this).attr("title","点击按价格从高到低排序");})

CSS代码:

.price{cursor:pointer;position:relative;width:73px;}

.price span{position:absolute;top:7px;right:0;margin-left:5px;width:8px;height:4px;background-image:url(../images/price.png); background-repeat:no-repeat;}

.price .price_asc{background-position:0 0;}

.price .price_desc{background-position:0 -6px;}

更多信息请查看IT技术专栏

推荐信息
Baidu
map