视频

//8. 商品详情的切换显示
function products() {
  $('#product_detail>ul>li').click(function () {
    $(this).siblings().removeClass('current') //兄弟姐妹去掉被选中的状态
    $(this).addClass('current') //本身添加 class
    var index = $(this).index() //得到在兄弟中的下标
    //找到5个div 把他们隐藏 找到当前的索引,根据当前的索引 显示当前div
    $('#product_detail>div:not(:eq(0))').hide().eq(index).show()
  })
}


posted on 2023-01-25 17:56  垂序葎草  阅读(101)  评论(0编辑  收藏  举报