锘?(function () { var topSwiper, selectSwiper, productSwiper, productIndex = 0, productTimer = null, autoTimer = null; topSwiper = new Swiper('.top-swiper', { autoplay: 5000, autoplayDisableOnInteraction: false, pagination: '.pagination1', paginationClickable: true, autoHeight: true, resistanceRatio: 0, observer: true, observeParents: false, prevButton: '.prev1', nextButton: '.next1', loop: true }); selectSwiper = new Swiper('.select-swiper', { autoHeight: true, resistanceRatio: 0, observer: true, observeParents: false, onSlideChangeStart: function (swiper) { console.log('swiper.activeIndex', swiper.activeIndex) $('.select-title').children('span').eq(swiper.activeIndex).addClass('active').siblings().removeClass('active'); } }) var brandSwiper = new Swiper('.brand-swiper', { resistanceRatio: 0, autoHeight: true, slidesPerView: 7, spaceBetween: 6, freeMode: true, observer: true, observeParents: false, }) // 閫夋嫨浼借摑鏂伴椈 鎴 瑙嗛涓撳尯 $('.js-selectNewsItem').find('span').on('click', function () { $(this).addClass('active').siblings().removeClass('active'); selectSwiper.slideTo($(this).index()) }) // 棰勮瑙嗛 $('.js-showVideo').on('click', function () { console.log('棰勮') var video = $(this).data('video'); var poster = $(this).data('poster'); $('#video-wrapper').find('video').attr({ src: video, poster: poster }); $('#video-wrapper').fadeIn(); $('#video-wrapper').on('click', function (e) { if (e.target == e.currentTarget) { $('#video-wrapper').find('video')[0].pause(); $('#video-wrapper').fadeOut(); } }) }) // 閫夋嫨浜у搧 $('.js-product-title').find('span').on('click', function () { clearInterval(productTimer); clearTimeout(autoTimer); autoTimer = setTimeout(function () { funProductTimer(); }, 2000); productIndex = $(this).index(); $(this).addClass('active').siblings().removeClass('active'); $('.js-product-swiper').hide(0) $('.js-product-swiper').eq(productIndex).show(0) }) funProductTimer(); // 鑷姩寰幆 鎾斁浜у搧swiper function funProductTimer() { productTimer = setInterval(function () { productIndex++; if (productIndex == $('.js-product-swiper').length) productIndex = 0; $('.js-product-title span').removeClass('active').eq(productIndex).addClass('active'); $('.js-product-swiper').hide(0) $('.js-product-swiper').eq(productIndex).show(0) }, 5000) } $('.notify-close-btn').on('click', function () { console.log('鐐瑰嚮鍏抽棴') $('.notify').addClass('hide'); $('.notify-shade').addClass('hide'); }) $('.notify').css('margin-top', 0 - ($('.notify')[0].offsetHeight / 2)); })