// 轮播图
$('.lunbozi').children().mouseenter(function () {
$(this).addClass('lunbobian').siblings().removeClass('lunbobian')
})
$(function () {
// 每个图的宽度
let liWidth = $('.lunbotu li').eq(0).width
console.log($('.lunbotu li').length)
let index = 0
// 图片索引 num
let num = 0;
function autoMove() {
//图片的变化
index++;
if (index == $('.lunbotu li').length) {
index = 0
}
$('.lunbotu').stop().animate({
'margin-left': -index * 820
})
// 图标变化
num++
if (num == $('.lunbozi div').length) {
num = 0
}
$('.lunbozi div').eq(num).addClass('lunbobian').siblings().removeClass('lunbobian')
}
setInterval(function () {
autoMove()
}, 3000)
//添加移入事件
$('.lunbozi div').mouseenter(function () {
// console.log($('.lunbozi div'))
// console.log($(this))
//获取移入时的索引
num = index = $(this).index()
// console.log(num)fsx
$('.lunbotu').stop().animate({
'margin-left': -index * 820
})
})
})