$(function () { //research-img模块 var imgs = $('.research-img>.img img'); var lis = $('.change>li'); var texts = $('.research-img>.content>.text'); lis.hover( function () { let this_ = $(this); let index = this_.index(); this_.addclass('liactive').siblings().removeclass('liactive'); this_.children('.arrow').addclass('arrowactive'); this_.siblings().children('.arrow').removeclass('arrowactive'); imgs.eq(index).addclass('imgactive'); imgs.eq(index).siblings().removeclass('imgactive'); texts.eq(index).siblings().stop(true, true).hide(); texts.eq(index).stop(true, true).fadein(1500); } ) //achievements模块 var resultli = $('.machine>.list'); resultli.click( function () { let this_ = $(this); let num = $(this).data("num"); reswiper.slideto(num, 600, false); this_.addclass('mactive'); this_.siblings().removeclass('mactive'); this_.children('.intro').stop(true, false).slidedown(500); // this_.siblings().children('.intro').hide(); this_.siblings().children('.intro').stop(true, false).slideup(500); } ) if ($('.resultswiper').length > 0) { var reswiper = new swiper('.resultswiper', { direction: 'horizontal', loop: false, effect: 'fadein', parallax: true, on: { init: function () { swiperanimatecache(this); this.emit('transitionend'); }, transitionend: function () { swiperanimate(this); }, slidechangetransitionstart: function () { // alert(this.activeindex); resultli.eq(this.activeindex).addclass('mactive'); resultli.eq(this.activeindex).siblings().removeclass('mactive'); resultli.eq(this.activeindex).children('.intro').stop(true, false).slidedown(500); resultli.eq(this.activeindex).siblings().children('.intro').stop(true, false).slideup(500); }, }, lazy: { loadprevnext: true, }, // pagination: { // el: '.machine', // type: 'custom', // clickable: true, // rendercustom: function (swiper, current, total) { // // 分页器点击的时候同时切换轮播图(事件委托)----循环模式slidetoloop-- // $('.machine').on('click', 'li', function () { // console.log($(this)); // reswiper.slidetoloop($(this).index(), 1000, false); // }) // } // }, }); } // console.log($('.machine').children().length); // if ($(document).width() > 1020 && $('.machine').children().length > 4) { // // 鼠标进入到区域后,则存储当前window滚动条的高度 // var scrolltop = -1; // $('.machine').hover(function (event) { // scrolltop = $(window).scrolltop(); // }, function (event) { // scrolltop = -1; // }); // // // 鼠标进入到区域后,则强制window滚动条的高度 // $(window).scroll(function (event) { // let flag = $(".machine").is(':hover'); // if (flag) { // scrolltop !== -1 && $(this).scrolltop(scrolltop); // } // }) // } //弹窗 // // $('.popups').hide(); // $('.platform .box').click(function () { // $('.popups').fadein(300); // top = $(window).scrolltop(); // $('body').css("top", -top + "px"); // $('body').addclass('fixed'); // }) // $(".popups .close").click(function () { // $('.popups').fadeout(300); // $('body').removeclass('fixed'); // $('body').removeattr("style"); // $(window).scrolltop(top); // }) })