var windowWidth = $(window).width() function tabSwitch(tabList, detailList, clasName) { var tabList = $(tabList) $.each(tabList, function (i, e) { $(this).click(function (e) { e.preventDefault(); if ($(this).hasClass(clasName)) { return false } else { var key = $(this).data('key'); var contentList = $(detailList) $(this).addClass(clasName) $(this).siblings().removeClass(clasName) $.each(contentList, function (i, e) { var currentKey = $(this).data('key') if (currentKey == key) { $(this).addClass(clasName) $(this).siblings().removeClass(clasName) } }); } }); }); } tabSwitch('div.right-list li.list-item', 'div.skill-intro', 'active') tabSwitch('div.video-tab-list li.list-item', 'div.monitoring', 'active') tabSwitch('div.page-tab-list-s li.list-item', 'div.service', 'active') tabSwitch('div.sfrz-works-list li.list-item', 'div.sfrz-work-case', 'active') $("div.solution div.content-list:first").show(); $('.tab-list li').on('click', function () { var index = $(this).index(); $('.tab-list li').removeClass('active'); $(this).addClass('active'); $('.content-list').hide(); $('.content-list').eq(index).show(); }) $("div.solution div.content-items:first").show(); $('.tab-list li').on('click', function () { var index = $(this).index(); $('.tab-list li').removeClass('active'); $(this).addClass('active'); $('.content-items').hide(); $('.content-items').eq(index).show(); }) var mySwiper2 = new Swiper('.works', { autoplay: 2000, loop: true, slidesPerView: windowWidth > 1024 ? 3 : 2, pagination: '.pagination', autoplayDisableOnInteraction: false }) var mySwiperClassroomCase = new Swiper('.swiper-container-case', { autoplay: 2000, loop: true, slidesPerView: windowWidth > 1024 ? 3 : 2, pagination: '.pagination.keyCase', autoplayDisableOnInteraction: false }) var top = $(window).scrollTop() if (top.scrollY > 0) { $('div.top').addClass('top-bg'); } $(window).on('scroll', function () { if ($(window).scrollTop() > 0) { $('div.top').addClass('top-bg'); } else { $('div.top').removeClass('top-bg'); } }); var swiperArray = new Array() swiperArray.push(new Swiper('.key01', { autoplay: 2000, loop: true, slidesPerView: windowWidth > 1024 ? 3 : 2, pagination: '.pagination.key01', autoplayDisableOnInteraction: false })) swiperArray.push(new Swiper('.tielu-video', { autoplay: 2000, loop: true, slidesPerView: windowWidth > 1024 ? 4 : 2, pagination: '.pagination.tielu', autoplayDisableOnInteraction: false })) var initEdArray = [1] var tabListWork = $('div.works-list li.list-item') var mySwiper3 $.each(tabListWork, function (i, e) { $(this).click(function (e) { console.log(111) mySwiper3 = null e.preventDefault(); var key = $(this).data('key'); var contentList = $('div.swiper-container.key') $(this).addClass('active') $(this).siblings().removeClass('active') $.each(contentList, function (i, e) { var currentKey = $(this).data('key') if (currentKey == key) { $(this).addClass('active') $(this).siblings().removeClass('active') if (initEdArray.indexOf(currentKey) == -1) { mySwiper3 = new Swiper('.key0' + currentKey + '', { autoplay: 2000, loop: true, slidesPerView: windowWidth > 1024 ? 3 : 2, pagination: '.pagination.key0' + currentKey + '', autoplayDisableOnInteraction: false }) initEdArray.push(currentKey) swiperArray[i] = mySwiper3 } swiperArray[i].swipeTo(0, 1000, false); } }); }); }); $('ul.video-list li.list-item').click(function (e) { $('div.video-play').show(); var src = $(this).find('video source').attr('src'); $("#video").attr('src', src); }); $('div.close-btn').click(function (e) { $('div.video-play').hide(); $("#video").attr('src', ''); }); $('.video-bg').click(function (e) { $('div.video-play').hide(); }); $('.slide-button').click(function (e) { e.preventDefault(); var on = $(this).hasClass('on') if (!on) { $(this).addClass('on') $('div.nav-wrapper-phone').slideDown(300); } else { $(this).removeClass('on'); $('div.nav-wrapper-phone').slideUp(300); } }); var outClassName = 'animated flipOutX faster' var inClassName = 'animated flipInX faster' $('div.idcard-3-list li.list-item').mouseenter(function () { var img = $(this).find('div.content-bg img') var desc = $(this).find('div.content-bg div.img-desc') img.addClass(outClassName); img.hide() desc.show() desc.addClass(inClassName); }); $('div.idcard-3-list li.list-item').mouseleave(function () { var img = $(this).find('div.content-bg img') var desc = $(this).find('div.content-bg div.img-desc') desc.removeClass(inClassName); desc.hide() img.removeClass(outClassName); img.addClass(inClassName); img.show() }); var zhyqSwiper = new Swiper('.zhyq-swiper', { autoplay: 2000, loop: true, slidesPerView: windowWidth > 1024 ? 4 : 2, pagination: '.zhyq-pagination', autoplayDisableOnInteraction: false })