jQuery写的展开收起效果
2010年5月5日
没有评论
开始学习jQuery,写几个简单的效果.
Tips:You can change the code before run.
代码很简单源于jQuery很强大
var $category=$(".proList > .plCon"); $category.hide(); var $toggleBtn=$(".plTitle > em"); //alert($toggleBtn.html()); $toggleBtn.click(function(){ if($(this).parent(".plTitle").next().is(":visible")){ $(this).parent(".plTitle").next().slideUp("slow"); $(this).prev(".plTitle > a").css("background","url (http://www.wenan8.com/test/icon1.gif) no-repeat left center"); $(this).css("background","url(http://www.wenan8.com/test/icon3.gif) no-repeat left center").text("展开"); }else{ $(this).parent(".plTitle").next().slideDown("slow"); $(this).prev(".plTitle > a").css("background","url (http://www.wenan8.com/test/ico.gif) no-repeat left center"); $(this).css("background","url(http://www.wenan8.com/test/icon12.gif) no-repeat left center").text("收起"); } return false; })
Recent Comments