左边那一栏,点击第二个时,变成第一个是怎么做的???大神指导一下

http://austrator.com/jd/category.html
2025-03-18 16:36:54
推荐回答(1个)
回答1:

/**
* @author: Caden
* @Date: 11/6 0006 14:13
*/

$(function () {
$("#detail div").html($("#categories ul li:eq(0) span").html());

$("aside#categories ul li").bind("click", function () {
$("aside#categories ul li span").removeClass("current");

$(this).children("span").addClass("current");

// 注意下面这一行,因为左边每一行的高度是固定的(47px),所以你懂了吧

$(this).parents("#categories").animate({"scrollTop": $(this).index() * 47}, 400);

$("#contents").animate({"scrollTop": 0}, 0);

$("#detail div").html($(this).find("span").html());

});

});