【发布时间】:2012-01-21 23:47:14
【问题描述】:
【问题讨论】:
标签: jquery list bind fadein css-selectors
【问题讨论】:
标签: jquery list bind fadein css-selectors
试试这个小提琴http://jsfiddle.net/mdamC/149/
$("ul#links li a").unbind().bind('click', function(e) {
e.preventDefault();
e.stopPropagation();
$(this).toggleClass('active');
$(".descriptions").fadeOut();
//you must get the index of the parent <li> otherwise the index of the <a> is always 0!
var index = $(this).parent().index();
$(".descriptions").eq(index).fadeIn();
$('.active').removeClass('active');
$(this).addClass('active');
}, function(e) {
$(".descriptions").stop().fadeOut();
});
【讨论】:
你好修改了你的代码http://jsfiddle.net/mdamC/150/ Basicall 使用单击锚点的 href ,获取描述 div 并切换它。如果您正在寻找其他东西,请告诉我。
【讨论】: