jquery(function() { var max = jquery(".banner .item").length; var ibmax = jquery(".inbanner .initem").length; jquery(".numble .end").html(ibmax); var $banner = jquery(".banner"), $banneritem = $banner.find(".item"); $bannerimg = jquery(".banner .item .pimg"); $head_top = $(".header").height(); $('.banner').on('init', function(event, slick, currentslide, nextslide) { $(".item").first().removeclass("slick-current"); settimeout(function() { $(".item").first().addclass("slick-current"); }, 200); }); jquery(".banner").slick({ slide: ".item", autoplay: true, arrows: true, dots: true, infinite: true, easing: "easeinoutexpo", speed: 1000, autoplayspeed: 5500, pauseonhover: false, fade: true }).on({ 'beforechange': function(event, slick, currentslide, nextslide) { var _item = $(this).find(".item"); _item.eq(nextslide).addclass("show").siblings().removeclass("show"); } }); settimeout(function() { $banner.find(".item").eq(0).addclass("show"); }, 1); }); // 头部 var index_head = $(".yj-bot li.active").index(); var length_ = $(".yj-bot li.active").length; $(".yj-bot li").hover(function() { var yb_index = $(this).index(); $(this).addclass("active").siblings().removeclass('active'); }).mouseleave(function() { if(length_ > 0) { $(".yj-bot li").removeclass('active').eq(index_head).addclass('active'); } else { $(".yj-bot li").removeclass('active'); } });