jQuery选择器 品牌列表效果
来源:互联网 发布:安索夫矩阵 编辑:程序博客网 时间:2024/04/29 07:14
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <title></title> <script src="../jquerysource/jquery.js" type="text/javascript"></script> <script> $(function(){ var hide = $("ul li:gt(5):not(:last)"); hide.hide(); var btn= $("div.showmore>a"); btn.click(function(){ if(hide.is(":visible")){ hide.hide(); $(this).find("span").css("background","url(../img/down.gif) no-repeat 0 0").text("显示全部品牌") $("ul li").removeClass("promoted");//filter遍历元素集合,重新构造一个符合条件的集合 }else{ hide.show(); $(this).find("span").css("background","url(../img/up.gif) no-repeat 0 0").text("精简显示品牌") $("ul li").filter(":contains('佳能'),:contains('尼康'),:contains('奥林巴斯')").addClass("promoted");//filter遍历元素集合,重新构造一个符合条件的集合 } return false;//由于给超链接添加onclick事件,因此需要使用"return false"语句让浏览器认为用户没有点击该超链接,从而阻止该超链接跳转 }); }); </script></head><body><div class="SubCategoryBox"> <ul> <li ><a href="#">佳能</a><i>(30440) </i></li> <li ><a href="#">索尼</a><i>(27220) </i></li> <li ><a href="#">三星</a><i>(20808) </i></li> <li ><a href="#">尼康</a><i>(17821) </i></li> <li ><a href="#">松下</a><i>(12289) </i></li> <li ><a href="#">卡西欧</a><i>(8242) </i></li> <li ><a href="#">富士</a><i>(14894) </i></li> <li ><a href="#">柯达</a><i>(9520) </i></li> <li ><a href="#">宾得</a><i>(2195) </i></li> <li ><a href="#">理光</a><i>(4114) </i></li> <li ><a href="#">奥林巴斯</a><i>(12205) </i></li> <li ><a href="#">明基</a><i>(1466) </i></li> <li ><a href="#">爱国者</a><i>(3091) </i></li> <li ><a href="#">其它品牌相机</a><i>(7275) </i></li> </ul> <div class="showmore"> <a href="more.html"><span>显示全部品牌</span></a> </div></div></body><style> *{ 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(../img/down.gif) no-repeat 0 0;} .promoted a { color:#F50;}</style></html>
1 0
- jQuery选择器 品牌列表效果
- jquery实现品牌列表效果
- jQuery的品牌列表效果
- jQuery只网站品牌列表的效果
- jQuery某网站品牌列表效果
- jQuery--选择器案例--动态列表效果
- 网站品牌列表效果
- 锋利的jquery初体验--第二章 品牌列表效果
- jQuery精简品牌列表
- jquery精简品牌列表
- jQuery精简品牌列表
- 某网站品牌列表效果
- jQuery(第2章案例 动态品牌列表效果)2章完
- jQuery选择器实例列表
- 案例----某网站品牌列表的效果
- 利用jQuery实现->精简显示品牌列表
- jquery实现精简品牌列表功能
- 利用jQuery实现->精简显示品牌列表
- SPRINGMVC+MYBATIS+SPRING+REDIS
- 2016年安大校赛(补题)
- xcode ios项目导入opengles.framework或别的SDK出错解决
- 接入 OppoSDK时遇见的一个问题
- 利用反射模拟Struts2数据封装机制
- jQuery选择器 品牌列表效果
- 存储过程01
- Linux oracle-10g安装
- 蓝桥杯 ALGO-115 算法训练 和为T Java版
- 从C#到TypeScript_0
- 【SCOI2011】bzoj2331 地板
- fedora20 pci8311驱动移植
- Android GreenDao3.2配置及使用详解
- 逆向工程_Java