码迷,mamicode.com
首页 > Web开发 > 详细

jquery中index实现列表中元素的显示和隐藏

时间:2014-12-14 21:13:16      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   sp   on   div   2014   log   

var last = "";
var lastIndex = "";
$(".ykyw_list2 ul li").click(function(){
var current = $(this);
var currentIndex = $(this).index()+1;
if (currentIndex != lastIndex && lastIndex != "") {
last.removeClass("li_now");
last.next("div").hide();
}
$(this).addClass("li_now");
$(this).next("div").toggle();
last = current;
lastIndex = currentIndex;
})

bubuko.com,布布扣

bubuko.com,布布扣

 

jquery中index实现列表中元素的显示和隐藏

标签:blog   http   io   ar   sp   on   div   2014   log   

原文地址:http://www.cnblogs.com/cornucopia/p/4162958.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!