; $(function () { var defaults = { pageswiper: null, pageIndex: 0 }; totalObj.win = $.extend(defaults, { init: function () { var th = this // $(window).on('load', function() { if ($('.preloader').length) { $('.preloader').delay(100).fadeOut(500, function () { console.log("0000") //active wow // wow.init(); }); } th.scrollPage() th.treasuryFn() th.indexEvent() // }); }, scrollPage: function () { var isnews = $('.newsIsSwiper').length var opt = this; var swiper = new Swiper('.pageMain', { direction: 'vertical', mousewheel: true, noSwiping: true, scrollbar: { el: '.swiper-scrollbar', clickable: true, draggable: true, }, // direction: 'vertical', // mousewheel: true, slidesPerView: 'auto', // hashNavigation: true, speed: 800, // slidesPerView: 'auto', // freeMode: true, // setWrapperSize: true, on: { touchMove: function (event) { console.log('touchMove') return false }, slideChangeTransitionStart: function () { opt.pageIndex = this.activeIndex var ind = this.activeIndex console.log(ind) console.log(ind >= 1) if (ind >= 1) { $('.pagefootermenu').addClass("active") $('.headTOP').addClass("hide") } else { $('.headTOP').removeClass('hide') $('.pagefootermenu').removeClass('active') } }, resize: function () { if(isnews>0) { return ; } //窗口变化了 var WinWidth = $(window).width(); if (WinWidth > 1380) { swiper.params.freeMode=false } else { swiper.params.freeMode=true swiper.init() } }, scroll:function (){ var ind = this.activeIndex if (ind >= 1) { $('.pagefootermenu').addClass("active") $('.headTOP').addClass("hide") } else { $('.headTOP').removeClass('hide') $('.pagefootermenu').removeClass('active') } } // onSlideChangeStart: function(swiper) { //滑动父级需要激活滚轮事件 // swiper.enableMousewheelControl(); // } }, // hashNavigation: { // watchState: true, // }, }); this.pageswiper = swiper var WinWidth = $(window).width(); if(isnews>0) { return ; } if (WinWidth > 1380) { this.pageswiper.params.freeMode=false } else { this.pageswiper.params.freeMode=true this.pageswiper.init() } }, indexEvent: function () { $('.leftmenu').click(function () { $('.menuContainer').removeClass("showMenu"); $('.menuContainer').addClass("showMenu"); }) $('.close').click(function () { $('.menuContainer').removeClass("showMenu"); }) // 首页tab切换 $('.tabBarTop li').on('click', function (e) { var th = $(this); var ind = $(this).index(); var parents = $(this).parents('div'); th.addClass("active").siblings().removeClass("active"); if ($(this).parent().hasClass('isno')) return; parents.find('.tabBarCn li').eq(ind).show().siblings().hide(); certifySwiper.slideTo(ind) }) var certifySwiper = new Swiper('#certify .swiper-container', { watchSlidesProgress: true, slidesPerView: 'auto', slideToClickedSlide: true, grabCursor: true, // centeredSlides: true, loop: true, loopedSlides: 2, // autoplay: true, pagination: { el: '.swiper-pagination', clickable: true, }, on: { slideChangeTransitionStart: function (e) { var ind = this.realIndex $('.tabBarTop li').eq(ind).addClass("active").siblings().removeClass("active") $('.tabBarTop li').parents('div').find('.tabBarCn li').eq(ind).show().siblings().hide(); }, progress: function (progress) { // console.log(this.slides,'this.slides') for (i = 0; i < this.slides.length; i++) { var slide = this.slides.eq(i); var slideProgress = this.slides[i].progress; modify = 1; if (Math.abs(slideProgress) > 1) { modify = (Math.abs(slideProgress) - 1) * 0.3 + 1; } translate = slideProgress * modify * 260 + 'px'; scale = Math.abs(slideProgress) * 50; zIndex = 999 - Math.abs(Math.round(10 * slideProgress)); slide.transform('translateX(' + translate + ')'); slide.css('zIndex', zIndex); slide.css('paddingTop', scale + 'px'); slide.css('opacity', 1); if (Math.abs(slideProgress) > 2) { slide.css('opacity', 0); } } }, setTransition: function (transition) { for (var i = 0; i < this.slides.length; i++) { var slide = this.slides.eq(i) slide.transition(transition); } } } }) // console.log(certifySwiper) // 锚点定位 var th = this $('.pagefootermenu li').on('click', function () { console.log($(this).index() + 1) th.pageswiper.slideTo($(this).index()) if (($(this).index()) == $('.pagefootermenu li').length) { th.pageswiper.slideTo(0) } }) }, newsSwiperFn: function () { function newsSwiperFunc(id, b, c) { var newsSwiper = new Swiper(id, { navigation: { prevEl: b, nextEl: c } }) totalObj.newsArr.push(newsSwiper); } newsSwiperFunc("#newsSwiper1", ".newsListItem1 .prevBtn", ".newsListItem1 .nextBtn"); }, treasuryFn: function () { var swiper = new Swiper('.treasury-container', { loop: true, lazy: { loadPrevNext: true, }, autoplay: { delay: 6000, stopOnLastSlide: false, disableOnInteraction: true, }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, pagination: { el: '.swiper-pagination', clickable: true, }, }); //0.625 5/8 // function homeResize() { // WinHeight = $(window).height(); // WinWidth = $(window).width(); // fullBox = $(".swiper-slide .full"); // if (WinWidth > 768) { // if (WinWidth / WinHeight > 1.6) { // fullBox.width("100%").height(WinWidth * 0.625).css({ // "position": 'absolute', // "left": "0px", // "top": (WinHeight - fullBox.height()) / 2 + "px" // }); // } else { // fullBox.width(WinHeight * 1.6).height("100%").css({ // "position": 'absolute', // "left": "-" + (fullBox.width() - WinWidth) / 2 + "px", // "top": "0px" // }); // } // } else { // fullBox.width("100%").height("auto").css({ // "position": 'static', // }); // } // } // homeResize(); var th = this var text_swiper = new Swiper('.text-container', { direction: 'vertical', slidesPerView: 'auto', // nested: true, // resistanceRatio: 0, freeMode: true, scrollbar: { el: '.swiper-scrollbar', }, mousewheel: true }); // 嵌套 var nesting_swiper = new Swiper('.nesting_swipercontainer', { direction: 'vertical', slidesPerView: 'auto', freeMode: true, nested: true, resistanceRatio: 0, speed: 1200, // autoHeight: true, mousewheel: true, simulateTouch: false, setWrapperSize: true, scrollbar: { el: '.swiper-scrollbar', clickable: true, draggable: true, }, mousewheel: { releaseOnEdges: true, }, on: { scroll: function (event) { var p_index = th.pageswiper.activeIndex var p_itemheight = th.pageswiper.realIndex if (p_itemheight == 1) { th.pageswiper.mousewheel.disable(); //禁止鼠标滑轮控制 if (nesting_swiper.isEnd || nesting_swiper.isBeginning) { th.pageswiper.mousewheel.enable(); } } else { th.pageswiper.mousewheel.enable(); //禁止鼠标滑轮控制 } } }, }); var nesting_swiper_2 = new Swiper('.nesting_swipercontainer_2', { direction: 'vertical', slidesPerView: 'auto', freeMode: true, nested: true, resistanceRatio: 0, speed: 1200, // autoHeight: true, mousewheel: true, simulateTouch: false, setWrapperSize: true, scrollbar: { el: '.swiper-scrollbar', clickable: true, draggable: true, }, mousewheel: { releaseOnEdges: true, }, on: { scroll: function (event) { var p_index = th.pageswiper.activeIndex var p_itemheight = th.pageswiper.realIndex console.log(p_itemheight) if (p_itemheight == 2) { th.pageswiper.mousewheel.disable(); //禁止鼠标滑轮控制 if (nesting_swiper_2.isEnd || nesting_swiper_2.isBeginning) { th.pageswiper.mousewheel.enable(); } } // else if (p_itemheight == 2) { // th.pageswiper.slideTo(2) // } else { th.pageswiper.mousewheel.enable(); //禁止鼠标滑轮控制 } } }, }); var swiperList = new Swiper('.swiperList-container', { slidesPerView: 'auto', // centeredSlides: true, // spaceBetween: 30, freeMode: true, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, pagination: { el: '.swiper-pagination', clickable: true, }, }); // 亮点 $('.treasury .page3 .rightList .item-slide').on('click', function (event) { event.stopPropagation(); var th = $(this); var ind = th.index() $(this).parents('.rightList').find('.boxlist').fadeIn() $(this).parents('.rightList').find('.boxlist li').eq(ind).show().siblings('li').hide() }) $('.treasury .page3 .rightList .boxlist li .tab span').on('click', function (event) { var th = $(this); var ind = th.index() // $(this).addClass('active').siblings().removeClass('active') th.hide().siblings().show() th.parents('li').find('.listBox>div').eq(ind).show().siblings().hide() event.stopPropagation(); }) $('.treasury .page3 .rightList .boxlist .icon_close').on('click', function (event) { event.stopPropagation(); var th = $(this); $(this).parents('.rightList').find('.boxlist').fadeOut() $(this).parents('.rightList').find('.boxlist li').hide() }) $('.characeristics li').on("click", function () { var _th = $(this); $.each(_th.siblings(), function (a, b) { $(b).find('div').eq(0).text('+') }) _th.find('div').eq(0).text('-') setTimeout(function () { swiperList.update(true); swiperList.updateSlides() swiperList.slideTo(_th.index()) }, 200) _th.parents('.page3').find('.swiperList-container .swiper-slide').eq(_th.index()).addClass('active').siblings().removeClass('active') }) // var text_swiper001 = new Swiper('.text-container', { // direction: 'vertical', // slidesPerView: 'auto', // nested: true, // resistanceRatio: 0, // scrollbar: { // el: '.swiper-scrollbar', // }, // mousewheel: true // }); // console.log(text_swiper001) $('.treasury .page4 .tabBarCn li').on('click', function (event) { var self = $(this); var ind = self.index(); self.show().addClass('active').siblings().removeClass('active').hide() $('.treasury .page4 .tabBarTop li').eq(ind).addClass('active').siblings().removeClass('active') event.stopPropagation(); }) $('.treasury .page4 .tabBarCn li .linknet').on('click', function (event) { var self = $(this); var _ind = self.parents('li').index() $('.imgbaoxiang1').hide() $('.imgbaoxiang2').fadeIn() // console.log(_ind) // var ind = _ind == 3 ? 0 : _ind + 1 // $('.treasury .page4 .tabBarCn li').show() // self.parents('ul').find('li').eq(ind).show(500).addClass('active').siblings().removeClass('active').hide() // $('.treasury .page4 .tabBarTop li').eq(ind).addClass('active').siblings().removeClass('active') // $(this).parents('.rightList').find('.boxlist').fadeIn() event.stopPropagation(); }) $('.treasury .page4 .tabBarTop li').on('click', function () { var self = $(this); var ind = self.index(); $('.imgbaoxiang1').show() $('.imgbaoxiang2').hide() $('.treasury .page4 .tabBarCn li').show() $('.treasury .page4 .tabBarCn li').eq(ind).show(500).addClass('active').siblings().removeClass('active').hide() }) // 尊享服务 $('.treasury .page5 .boxfooter li').on('click', function (event) { var self = $(this); self.addClass('active').siblings().removeClass('active') var ind = self.index(); console.log(ind) var box = self.parents('div').find('.box') var left = box.find('ul.left') var right = box.find('ul.right') left.find('li').eq(ind).addClass('active').siblings().removeClass('active') right.find('li').eq(ind).addClass('active').siblings().removeClass('active') $.each(text_swiper, function (a, b) { b.update(true); }) // text_swiper.update(true); console.log(text_swiper) }) $('.treasury .page5 .left li .footerTitle .divbox').on('click', function (event) { var self = $(this); var ind = $(this).attr('data-ind') var box = self.parents('.li') var left = box.find('ul.left') var right = box.find('ul.right') console.log(ind) left.find('li').eq(ind).addClass('active').siblings().removeClass('active') right.find('li').eq(ind).addClass('active').siblings().removeClass('active') if (ind == 6) { $('.treasury .page5 .boxfooter li').removeClass('active') } $.each(text_swiper, function (a, b) { b.update(true); }) // text_swiper.update(true); console.log(text_swiper) }) // 联动展开 $('.treasury .page6 .cntext li').on('click', function (event) { var self = $(this); var parent = self.parents('ul') if (self.hasClass('active')) { self.removeClass('active') // parent.find('.text').slideToggle() } else { self.addClass('active') } self.find('.text').slideToggle(); self.siblings().removeClass('active').find('.text').hide() setTimeout(function () { $.each(text_swiper, function (a, b) { b.updateSlides() }) }, 800) }) $('.language span').on('click', function (e) { // $('.treasury .page6 .cntext li') if (e.target.className === 'cn_nav') { $('.treasury .page6 .box1 .cn').fadeIn("300") $('.treasury .page6 .box1 .en').hide() $('.treasury .page6 .box1 .cn .mouseOUT').eq(1).height('65%') } else { $('.treasury .page6 .box1 .en').fadeIn("300") $('.treasury .page6 .box1 .cn').hide() $('.treasury .page6 .box1 .en .mouseOUT').eq(1).height('40%') } setTimeout(function () { $.each(text_swiper, function (a, b) { b.update(true); b.updateSlides() }) }, 300) console.log(e) }) // var swiper = new Swiper('.CPARTSPACE_swiper', { slidesPerView: 2, spaceBetween: 120, grabCursor: true, autoHeight: true, }); // 尊享服务 var zxfwIndex = 0; $('.joyofart .page3 .boxfooter li').on('click', function (event) { var self = $(this); self.addClass('active').siblings().removeClass('active') var _ind = self.index(); var ind = _ind + 1; zxfwIndex = ind; console.log(ind) var box = self.parents('div').find('.box') var left = box.find('ul.left') var right = box.find('ul.right') left.find('li').eq(ind).addClass('active').siblings().removeClass('active') right.find('li').eq(ind).addClass('active').siblings().removeClass('active') $.each(text_swiper, function (a, b) { b.update(true); }) // text_swiper.update(true); console.log(text_swiper) }) $('.joyofart .page3 .goBack').on('click', function (event) { var self = $(this); $('.joyofart .page3 .boxfooter li').removeClass('active') $('.joyofart .page3 ul.left li').eq(0).addClass('active').siblings().removeClass('active') $('.joyofart .page3 ul.right li ').eq(0).addClass('active').siblings().removeClass('active') }) $('.joyofart .page3 .navigationLeft').on('click', function (event) { var self = $(this); --zxfwIndex if (zxfwIndex == -1) zxfwIndex = 8 $('.joyofart .page3 .boxfooter li').removeClass('active') if (zxfwIndex != 0) $('.joyofart .page3 .boxfooter li').eq(zxfwIndex - 1).addClass('active').siblings().removeClass('active') $('.joyofart .page3 ul.left li').eq(zxfwIndex).addClass('active').siblings().removeClass('active') $('.joyofart .page3 ul.right li ').eq(zxfwIndex).addClass('active').siblings().removeClass('active') console.log(zxfwIndex) }) $('.joyofart .page3 .navigationRight').on('click', function (event) { var self = $(this); ++zxfwIndex if (zxfwIndex == 9) zxfwIndex = 0 $('.joyofart .page3 .boxfooter li').removeClass('active') if (zxfwIndex != 0) $('.joyofart .page3 .boxfooter li').eq(zxfwIndex - 1).addClass('active').siblings().removeClass('active') $('.joyofart .page3 ul.left li').eq(zxfwIndex).addClass('active').siblings().removeClass('active') $('.joyofart .page3 ul.right li ').eq(zxfwIndex).addClass('active').siblings().removeClass('active') // if(zxfwIndex) console.log(zxfwIndex) }) $(".mouseOUT").hover(function () { console.log(nesting_swiper_2) th.pageswiper.mousewheel.disable(); //禁止鼠标滑轮控制 if (nesting_swiper_2.mousewheel) nesting_swiper_2.mousewheel.disable(); }, function () { th.pageswiper.mousewheel.enable(); //禁止鼠标滑轮控制 if (nesting_swiper_2.mousewheel) nesting_swiper_2.mousewheel.enable(); //禁止鼠标滑轮控制 }); $('.news .tabList .tabItem').on('click', function () { var self = $(this); self.addClass('current').siblings().removeClass('current') $('.infoList').hide() $('.infoList').eq(self.index()).show() nesting_swiper.update(true); nesting_swiper.updateSlides() }) $('.contact .tabtoplist .item').on('click', function () { var self = $(this); self.addClass('active').siblings().removeClass('active') $('.contact .content .itemBox').eq($(this).index()).show().siblings().hide() }) $('.recruit_swiper .navlist li').on('click', function () { var self = $(this); var id = self.attr('data-id') $('.contact .page2 .right .cntext>div').hide() $('.jobList_' + id).show() $.each(text_swiper, function (a, b) { b.update(true); }) console.log(self.attr('data-id'), '.jobList_' + id) }) var swiper = new Swiper('.recruit_swiper', { slidesPerView: 1, grabCursor: true, // autoHeight: true, pagination: { el: '.swiper-pagination', }, }); $('.gotop').click(function () { th.pageswiper.slideTo(0) }) // $('.index .page3 .ProjectswiperSlide').on('click',function(){ // console.log($(this).index()) // }) } }); totalObj.win.init(); });