var app={ // 简单的点击实现元素展开和收缩的功能 clickToggle: function(elea,eleb){ $(elea).click(function(){ if(!$(eleb).is(':visible')){ $(this).addClass('clicked'); $(eleb).slideDown(); }else{ $(this).removeClass('clicked'); $(eleb).slideUp(); } }) }, // 防复制代码 antiClone: function () { // 防止ctrl+C document.onkeydown = function (e) { var e = e || event; if (e.ctrlKey == 1 && e.keyCode == 67) { return false; } }; // 阻止复制 document.body.oncopy = function (){ return false; }; //禁止选取 document.body.onselectstart=document.body.oncontextmenu=function(){return false;}; }, //返回顶部 backTop: function(ele,time){ $(ele).click(function () { $('html, body').animate({ scrollTop:'0' },time); }) }, // tab 切换 tabs: function(tabs, tab_box, _event) { $(tab_box).hide(); $(tab_box).eq(0).show(); $(tabs).eq(0).addClass('on'); $(tabs).bind(_event,function(){ $(this).addClass("on").siblings().removeClass("on"); var _index = $(this).index(); $(tab_box).eq(_index).show().siblings().hide(); }) }, // tab 切换类名 tabsa: function(tabsa, tab_boxa, _eventa) { $(tab_boxa).eq(0).addClass('a'); $(tabsa).eq(0).addClass('on'); $(tabsa).bind(_eventa,function(){ $(this).addClass("on").siblings().removeClass("on"); var _index = $(this).index(); $(tab_boxa).eq(_index).addClass('a').siblings().removeClass("a"); }) }, // 选中高亮 tabsb: function(tabsb,_eventb) { $(tabsb).eq(0).addClass('active'); $(tabsb).bind(_eventb,function(){ $(this).addClass("active").siblings().removeClass("active"); }) }, } $(function () { index.scrool(); index.click(); index.swiper(); // index.titleColor(); initJasHighlight(); initA4RingHighlight(); initA4DataTabJump(); initA4StickyTabVisibility(); app.clickToggle('.m-bm-navbtn','.m-bm-menu'); app.clickToggle('.sska','.searchbox1'); app.clickToggle('.sska','.sskbj'); app.clickToggle('.search-close-btn','.searchbox1'); app.clickToggle('.search-close-btn','.sskbj'); app.clickToggle('.zywena .rhgxt','.zywena .yy-sec'); app.tabs('.xw-sort1 li','.a4v2c1 .tta','mouseenter'); app.tabsb('.a6b2c1 li','mouseenter'); }) var index = { // 回到顶部 scrool: function () { // 鼠标下滑导航添加类 var $window = $(window); $window.scroll(function () { var scrollTop = $(document).scrollTop(); if (scrollTop > 600) { $(".aat_list li.tops").show(); } else { $(".aat_list li.tops").hide() } if (scrollTop > 0) { $('.head').addClass("sticky"); } else { $('.head').removeClass("sticky"); } }); $('.tops>a').click(function () { $("html, body").animate({ scrollTop: 0 }, { duration: 1000, easing: "swing" }); }); }, click: function () { // 锚点 $(".smooth").click(function(){ var href = $(this).attr("href"); var pos = $(href).offset().top; $("html,body").animate({scrollTop: pos}, 1000); return false; }); // 搜索框提示 $(".serbtn").click(function () { var ttas = $(".sertext").val() if (ttas == '') { layer.msg('请输入搜索关键词!', function () { time: 2000 }); return false; } }); $(".serbtn1a").click(function () { var ttasa = $(".sertexta").val() if (ttasa == '') { layer.msg('请输入搜索关键词!', function () { time: 2000 }); return false; } }); //导航下拉 // $('.nav_a1 > li').hover(function(){ // $(this).find('.sec').stop(true).slideToggle(300); // }); //头部搜索按钮 $(".ds").click(function () { $(".search").slideDown(); }); $(".search-con").click(function () { $(".search").slideUp(); }); $(function () { $('.msg-tc').on('click', function(){ // $(".pead-cont .tit").text($(this).text()); $(".pead-jsda").show(); }); $('a.jataxta').on('click', function(){ $(".pead-jsda").hide(); }); $(document).click(function(e){ if (!$(".zywena a.rhgxt").is(e.target) && $(".zywena a.rhgxt").has(e.target).length === 0){ $(".yy-sec").slideUp(); } }); }); //手机端导航 $(".aniut").click(function () { var mSubmenuBox = $(this).siblings('.sec'); var mSubmenuSiblingsBox = $(this).parents('li').siblings('li').find('.sec'); var mSubmenuSiblingsJt = $(this).parents('li').siblings('li').find('.aniut'); if(!mSubmenuBox.is(":visible")){ $(this).siblings('a.bl').addClass('clicked'); $(this).addClass('clicked'); mSubmenuBox.slideDown(); mSubmenuSiblingsJt.removeClass('clicked'); mSubmenuSiblingsBox.slideUp(); $(this).find(".iconfont").removeClass('icon-jiahao'); $(this).find(".iconfont").addClass('icon-jianhao'); mSubmenuSiblingsJt.find(".iconfont").removeClass('icon-jianhao'); mSubmenuSiblingsJt.find(".iconfont").addClass('icon-jiahao'); }else { $(this).removeClass('clicked'); $(this).siblings('a.bl').removeClass('clicked'); mSubmenuBox.slideUp(); $(this).find(".iconfont").removeClass('icon-jianhao'); $(this).find(".iconfont").addClass('icon-jiahao'); // mSubmenuBox.find(".iconfont").addClass('icon-jiahao'); } }); // 导航有锚点情况下点击关闭 $(".m-bm-nav li a").click(function(){ $(".m-bm-navbtn").removeClass('clicked'); $(".m-bm-menu").hide(); }); // 手机端点击不跳转 $(function () { if($(window).width()<990){ $('.xw_sort1 li a').removeAttr('href'); } }); // 锚点跳转 $(function() { var WH = $(".pc-banner").height(); $(".mouse").click(function(){ $('html,body').animate({'scrollTop':WH},500); }); }); //飞入 var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: true, live: true }); wow.init(); new WOW().init(); }, swiper: function (){ var swiper1 = new Swiper(".mySwiper1", { spaceBetween: 10, loop: true, autoplay: true, loopedSlides: 12, // autoHeight: true, // speed: 1000, pagination: { el: '.mySwiper1 .swiper-pagination1', clickable :true, }, }); }, // titleColor: function () { // var title = document.querySelector('.tita1'); // if (!title || typeof gsap === 'undefined' || typeof SplitText === 'undefined') { // return; // } // var split = new SplitText(title, { // type: 'chars', // charsClass: 'tita1-char' // }); // gsap.set(split.chars, { color: '#FFFFFF' }); // gsap.to(split.chars, { // color: '#0095FF', // duration: 0.35, // ease: 'none', // stagger: 0.055, // delay: 0.2 // }); // } } if ($('.navItems1').length) { var heightss = $(".head").height(); var heightss1 = $(".n_mbx1").height(); $(".navItems1").click(function () { var navto = $(this).attr('navto'); if (navto != "#") { var $div = $('#' + navto); var top = $div.offset().top || 0; $('html,body').animate({ 'scroll-top': top - heightss - heightss1 }, 500); } else { $('html,body').animate({ 'scroll-top': 0 }, 500); } }); } if ($.exists('.scroll-section')){ if($(window).width()>768){ const items = gsap.utils.toArray('.asgt1-list > li'); items.pop(); ScrollTrigger.create({ trigger: '.scroll-section', start: 'top top', end: 'bottom top-=300', // pin: true, scrub: true, // markers: true, animation: gsap.timeline().to(items, { // opacity: 0, y: '-5%', scale: 0.9, stagger: { each: 0.2, from: 'start', } }) }); } } /* $(function () { window.lenis = new Lenis({ duration: 1.25, smoothWheel: true, }); if (window.ScrollTrigger && window.gsap) { window.lenis.on('scroll', ScrollTrigger.update); gsap.ticker.add((time) => { window.lenis.raf(time * 1000); }); gsap.ticker.lagSmoothing(0); } else { const scrollFn = (time) => { window.lenis.raf(time); requestAnimationFrame(scrollFn); }; requestAnimationFrame(scrollFn); } }); */ function initJasHighlight () { var $items = $(".jas-a1 li"); if (!$items.length) { return; } var currentIndex = 0; var delay = 1800; function activeItem (index) { $items.removeClass("on").eq(index).addClass("on"); } activeItem(currentIndex); setInterval(function () { currentIndex = (currentIndex + 1) % $items.length; activeItem(currentIndex); }, delay); } // 鼠标 function initA4RingHighlight () { var $wrap = $(".a4v1"); var $items = $wrap.find(".ast1-ax li"); if (!$wrap.length || !$items.length) { return; } function activeItem (index) { $wrap.removeClass("is-active-1 is-active-2 is-active-3").addClass("is-active-" + (index + 1)); $items.removeClass("on").eq(index).addClass("on"); } activeItem(0); $items.on("mouseenter", function () { activeItem($(this).index()); }); $wrap.on("mouseleave", function () { activeItem(0); }); } // 切换 function initA4DataTabJump () { $("[data-id]").on("click", function (e) { var targetId = $(this).attr("data-id"); var $targetTab = $('.a4v2-a1 [data-cid="' + targetId + '"]'); if (!$targetTab.length) { return; } e.preventDefault(); $targetTab.trigger("mouseover").trigger("click"); if ($("#abt").length) { $("html, body").stop().animate({ scrollTop: $("#abt").offset().top }, 500); } }); } // function initA4StickyTabVisibility () { var $tab = $(".a4v2-a1"); if (!$tab.length) { return; } function getStickyTop () { var top = parseFloat($tab.css("top")); return isNaN(top) ? 0 : top; } function updateTabState () { var rect = $tab[0].getBoundingClientRect(); var isSticky = Math.abs(rect.top - getStickyTop()) <= 1; $tab.toggleClass("is-fixed", isSticky); } updateTabState(); $(window).on("scroll resize", updateTabState); } jQuery(".zs_ta1>li").slide({titCell:".zs_tb1>li",mainCell:".zs_tb2"}); jQuery(".a4v2").slide({titCell:".a4v2-a1>li",mainCell:".a4v2-a2"}); if ($.exists('.reveal1')){ let revealContainers1 = document.querySelectorAll(".reveal1"); revealContainers1.forEach((container) => { let image = container.querySelector("img"); let t1 = gsap.timeline({ scrollTrigger: { trigger: container, } }); t1.set(container, { autoAlpha: 1 }); t1.from(container, 1.5, { opacity: 0, ease: Power2.out }); t1.from(image, 1.5, { scale: 1.3, delay: -1.5, ease: Power2.out }); }) }