您的位置:首页 > 运维架构 > 网站架构

例.网站品牌列表的效果

2012-05-03 14:32 483 查看
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

* {
margin: 0;
padding: 0;
}

body {
font-size: 12px;
text-align: center;
}

a {
color: #04D;
text-decoration: none;
}

a:hover {
color: #F50;
text-decoration: underline;
}

.SubCategoryBox {
width: 600px;
margin: 0 auto;
text-align: center;
margin-top: 40px;
}

.SubCategoryBox ul {
list-style: none;
}

.SubCategoryBox ul li {
display: block;
float: left;
width: 200px;
line-height: 20px;
}

.showmore {
clear: both;
text-align: center;
padding-top: 10px;
}

.showmore a {
display: block;
width: 120px;
margin: 0 auto;
line-height: 24px;
border: 1px solid #AAA;
}

.showmore a span {
padding-left: 15px;
background: url(images/down.gif) no-repeat 0 0;
}

.promoted a {
color: #F50;
}

/*
* 步骤:
* 1.从第7条开始隐藏后面的品牌,最后一条除外
* 2.当用户点击"显示全部品牌"后,
* (1)显示隐藏的品牌
* (2)“显示全部品牌“文本切换成”精简显示品牌“
* (3)高亮推荐品牌
* 3.当用户点击”精简显示品牌"后
* (1)从第7条开始隐藏后面的品牌,最后一条除外
* (2)"精简显示品牌“文本切换成”显示全部品牌“
* (3)去掉高亮的推荐品牌
* 4.循环进行第2步和第3步
* */
$(function () { // 等待DOM加载完毕.
var $category = $("ul li:gt(5):not(:last)"); // 获得索引值大于5的品牌集合对象(除最后一条)
$category.hide(); // 隐藏上面获取到的jQuery对象。
var $toggleBtn = $("div.showmore a span"); // 获取“显示全部品牌”按钮
$toggleBtn.click(function () {
if ($category.is(":visible")) {
$category.hide(); // 隐藏$category
$toggleBtn
.css("background", "url(images/down.gif) no-repeat 0 0")
.text("显示全部品牌"); //改变背景图片和文本
$("ul li").removeClass("promoted");// 去掉高亮样式
} else {
$category.show(); // 显示$category
$toggleBtn
.css("background", "url(images/up.gif) no-repeat 0 0")
.text("精简显示品牌"); //改变背景图片和文本
$("ul li")
.filter(":contains('索尼'),:contains('尼康'),:contains('柯达'),:contains('奥林巴斯')")
.addClass("promoted"); //添加高亮样式
}
return false; //超链接不跳转
});
});

佳能(30440)

索尼(27220)

三星(20808)

尼康(17821)

松下(12289)

卡西欧(8242)

富士(14894)

柯达(9520)

宾得(2195)

理光(4114)

奥林巴斯(12205)

明基(1466)

爱国者(3091)

其它品牌相机(7275)

显示全部品牌
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: