// 滚动条监听事件 用于滚动特效滚动 // let scrollGun = true; // $(window).scroll(function(){//开始监听滚动条 // //获取当前滚动条高度 // let topp = $(document).scrollTop(); // if(topp>300 && scrollGun){ // // 调用数字滚动函数 // // numScroll('chuangli',1999,2000); // numScroll('yuangong',$('#yuangong').text(),2000); // numScroll('zhuanli',$('#zhuanli').text(),2000); // numScroll('huojiang',$('#huojiang').text(),2000); // numScroll('gongsi',$('#gongsi').text(),2000); // scrollGun = false; // } // }); // 页头搜索框点击事件 $(".header_search_box .shanchu").click(function(){ $(".header_search_box input").val(""); }) let shou = true; $(".header_search .search").click(function(){ if(shou){ $(".header_search .search img").attr("src","/template/default/images/index/tou/sousuo.png"); $(".header_search .search img").css("width","25%"); $(".header_search .search").addClass("search_cha"); $(".header_search_box").stop().slideDown(300,function(){ $(".header_search_box").css("display","block"); }) shou = false; }else{ $(".header_search .search").removeClass("search_cha"); $(".header_search .search img").attr("src","/template/default/images/index/top/search2.png"); $(".header_search .search img").css("width","100%"); $(".header_search_box").stop().slideUp(300,function(){ $(".header_search_box").css("display","none"); $(".header_search_box input").val(""); }) shou = true; } }) // 页头面包屑下滑 let bol = true; $(".header_menu").click(function(){ if(bol){ $(".header_nav").stop().slideDown(300,function(){ $(".header_nav").css("display","block"); }); bol = false; }else{ $(".header_nav").stop().slideUp(300,function(){ $(".header_nav").css("display","none"); }); bol = true; } }); // 页头二次菜单 $(".header_nav>li").mouseenter(function(){ $($(this)[0].children[1]).stop().slideDown(300); }); $(".header_nav>li").mouseleave(function(){ $($(this)[0].children[1]).stop().slideUp(300); }); // 页头轮播图 let swiper1 = new Swiper('#swiper1',{ // grabCursor : true,// 触摸变成手掌 autoplay: 2000, speed:1000, // 速度 loop : true, // 让Swiper看起来是循环的 pagination : '.swiper-pagination', paginationClickable :true, }); //鼠标覆盖停止自动切换 $("#swiper1").mouseenter(function(){ swiper1.stopAutoplay(); }); //鼠标离开开始自动切换 $("#swiper1").mouseleave(function(){ swiper1.startAutoplay(); }); // 产品方案轮播图 var sw1Swiper = new Swiper('.sw1 .swiper-container', { autoplay: 2400,speed: 800,autoplayDisableOnInteraction: false, prevButton: '.sw1 #swiper-button1',nextButton: '.sw1 #swiper-button2', slidesPerView: 4,spaceBetween: 4, breakpoints: { 480: { slidesPerView: 1,spaceBetween: 10},640: {slidesPerView: 2,spaceBetween: 10},1000: {slidesPerView: 3,spaceBetween: 10}} }); $(".sw1").mouseenter(function(){sw1Swiper.stopAutoplay();}); $(".sw1").mouseleave(function(){sw1Swiper.startAutoplay();}); var sw2Swiper = new Swiper('.sw2 .swiper-container', { autoplay: 2400,speed: 800,autoplayDisableOnInteraction: false, prevButton: '.sw2 #swiper-button1',nextButton: '.sw2 #swiper-button2', slidesPerView: 4,spaceBetween: 4, breakpoints: { 480: { slidesPerView: 1,spaceBetween: 10},640: {slidesPerView: 2,spaceBetween: 10},1000: {slidesPerView: 3,spaceBetween: 10}} }); $(".sw2").mouseenter(function(){sw2Swiper.stopAutoplay();}); $(".sw2").mouseleave(function(){sw2Swiper.startAutoplay();}); var sw3Swiper = new Swiper('.sw3 .swiper-container', { autoplay: 2400,speed: 800,autoplayDisableOnInteraction: false, prevButton: '.sw3 #swiper-button1',nextButton: '.sw3 #swiper-button2', slidesPerView: 4,spaceBetween: 4, breakpoints: { 480: { slidesPerView: 1,spaceBetween: 10},640: {slidesPerView: 2,spaceBetween: 10},1000: {slidesPerView: 3,spaceBetween: 10}} }); $(".sw3").mouseenter(function(){sw3Swiper.stopAutoplay();}); $(".sw3").mouseleave(function(){sw3Swiper.startAutoplay();}); var sw4Swiper = new Swiper('.sw4 .swiper-container', { autoplay: 2400,speed: 800,autoplayDisableOnInteraction: false, prevButton: '.sw4 #swiper-button1',nextButton: '.sw4 #swiper-button2', slidesPerView: 4,spaceBetween: 4, breakpoints: { 480: { slidesPerView: 1,spaceBetween: 10},640: {slidesPerView: 2,spaceBetween: 10},1000: {slidesPerView: 3,spaceBetween: 10}} }); $(".sw4").mouseenter(function(){sw4Swiper.stopAutoplay();}); $(".sw4").mouseleave(function(){sw4Swiper.startAutoplay();}); var sw5Swiper = new Swiper('.sw5 .swiper-container', { autoplay: 2400,speed: 800,autoplayDisableOnInteraction: false, prevButton: '.sw5 #swiper-button1',nextButton: '.sw5 #swiper-button2', slidesPerView: 4,spaceBetween: 4, breakpoints: { 480: { slidesPerView: 1,spaceBetween: 10},640: {slidesPerView: 2,spaceBetween: 10},1000: {slidesPerView: 3,spaceBetween: 10}} }); $(".sw5").mouseenter(function(){sw5Swiper.stopAutoplay();}); $(".sw5").mouseleave(function(){sw5Swiper.startAutoplay();}); // $(".product-item .swiper-container").each(function(){ // $(this).swiper({ // nextButton: $('#swiper-button2',this), // prevButton: $('#swiper-button1',this), // observer:true, // observeParents:true, // autoplay: 3600, // slidesPerView: 4, // 默认一次展示4张图片 // spaceBetween: 4, // 轮播图间隔 // breakpoints: { // //当宽度小于等于480 // 480: { // slidesPerView: 1, // spaceBetween: 10 // }, // //当宽度小于等于640 // 640: { // slidesPerView: 2, // spaceBetween: 10 // }, // 1000: { // slidesPerView: 3, // spaceBetween: 10 // } // } // }); // }); // 行业应用轮播图 let swiper3 = new Swiper('#swiper3',{ slidesPerView : 3, // 一次展示3张图片 spaceBetween : 8, // 轮播图间隔 nextButton: '#swiper-button4', prevButton: '#swiper-button3', breakpoints: { //当宽度小于等于480 640: { slidesPerView: 1, spaceBetween: 5 }, 1000: { slidesPerView: 2, spaceBetween: 5 } } }); $(".yqlj").mouseenter(function(){ $(".yqlj-box").show(); }) $(".yqlj").mouseleave(function(){ $(".yqlj-box").hide(); }) // 滚动特效封装代码 /* id: 需要滚动的节点盒子 maxNum: 需要滚动到的数字 time: 滚动动画完成所需时间 */ function numScroll(id, maxNum, time) { let numDom = document.getElementById(id); // 获取节点 let numInit = 0; // 初始值 从0开始 let addNum = maxNum / (time / 10); // 滚动速度 let t = setInterval(function() { if (numInit >= maxNum) { clearInterval(t); // 关闭定时器 if(maxNum < 10){ numDom.innerText = maxNum; // 将节点内容改变成传参值 }else{ numDom.innerText = maxNum; // 将节点内容改变成传参值 } } else { if(maxNum < 10){ // 当前数值小于10 则0补位 numInit += addNum; numDom.innerText = "0" + Math.round(numInit); //动态改变数据 }else{ numInit += addNum; numDom.innerText = Math.round(numInit); //动态改变数据 } } }, 10) } // 轮播图分页切换 及 按钮切换 $(".container_chanpin ul li button").click(function(){ let num = 0; if($(this)[0].name == "button1"){ num = 0; }else if($(this)[0].name == "button2"){ num = 1; }else if($(this)[0].name == "button3"){ num = 2; }else if($(this)[0].name == "button4"){ num = 3; }else if($(this)[0].name == "button5"){ num = 4; }else if($(this)[0].name == "button6"){ num = 5; } // 清空所有按钮变色 $(".container_chanpin ul li button").css({ "color":"#000", "background":"#f7f7f7", "border":"2px solid #e4e4e4" }) // 当前点击选项变色 $(this).css({ "color":"#dfedf7", "background":"#0f76c5", "border":"none" }); // 隐藏所有轮播图 $(".product-item").removeClass("on"); // 显示当前轮播图 if(num == 0){ $(".product-item-container .product-item:eq(0)").addClass("on"); }else if(num == 1){ $(".product-item-container .product-item:eq(1)").addClass("on"); }else if(num == 2){ $(".product-item-container .product-item:eq(2)").addClass("on"); }else if(num == 3){ $(".product-item-container .product-item:eq(3)").addClass("on"); }else if(num == 4){ $(".product-item-container .product-item:eq(4)").addClass("on"); }else if(num == 5){ $(".product-item-container .product-item:eq(5)").addClass("on"); } }) // 时间轴 var p = $('.abolc-dot').width(), n = -50; $(".abolc-ldot .abolc-dotline").css("left",p + "px"); $(".abolc-rdot .abolc-dotline").css("left",n + "px"); var timerShaft = new Swiper('.abolc-time .swiper-container', { speed: 400, slidesPerView: 1, slidesPerGroup : 1, spaceBetween : 0, centeredSlides: true, slideToClickedSlide:true, prevButton: '.abolc-prev', nextButton: '.abolc-next', onSlideChangeStart: function(swiper){ comTeamMove(swiper.activeIndex,timerShaft,timerWords); } }); $(".abolc-ldot .abolc-dotck").bind("click",function(){timerShaft.slideTo($(this).index())}); $(".abolc-rdot .abolc-dotck").bind("click",function(){timerShaft.slideTo($(this).index())}); function comTeamMove(index,timerShaft,timerWords){ $(".abolc-ldot .abolc-dotline").stop().animate({left: (3 - index) * 50}, 300); $(".abolc-rdot .abolc-dotline").stop().animate({left: (-1 - index) * 50}, 300); if($(window).width()<1000){ $(".abolc-ldot .abolc-dotline").stop().animate({left: (2 - index) * 50}, 300); $(".abolc-rdot .abolc-dotline").stop().animate({left: (-1 - index) * 50}, 300); } if($(window).width()<640){ $(".abolc-ldot .abolc-dotline").stop().animate({left: (1 - index) * 50}, 300); $(".abolc-rdot .abolc-dotline").stop().animate({left: (-1 - index) * 50}, 300); } timerWords.slideTo(index);timerShaft.slideTo(index); } var timerWords = new Swiper('.abolc-wdbox .swiper-container', {speed: 0}); // over // 置顶 $(".sideBar-wrapper .backTop").click(function () { $("html,body").animate({ scrollTop: "0px" }, 800) }); // 页面body 添加类名 监听事件 bodyChange(); function bodyChange(){ if ($(window).width() <= 1000) {$("body").removeClass("winter");}else{$("body").addClass("winter");} } widthChange(); function widthChange(){ var window_width = $(window).width();//获取浏览器窗口宽度 // 超出设备提示 if (!!window.ActiveXObject || "ActiveXObject" in window){return false;} var rberMe = sessionStorage['rberMe'] || ''; if( window_width >= 2000 && rberMe==''){ sessionStorage['rberMe'] = 'www.yisiy.com'; var wthint = "您的显示设备已超出设计范围!为了布局美观,采取居中排版!确定吗?"; if (window.confirm(wthint)) {sessionStorage['rberMe'] = 'winter';$("body").addClass("body-maxwidth");} else{return;} } if(rberMe=='winter') {$("body").addClass("body-maxwidth");} } // 判断是否为IE浏览器 // if (!!window.ActiveXObject || "ActiveXObject" in window){alert("当前为IE浏览器,部分效果和样式不兼容!请更换浏览器,欣赏更佳!");} //浏览器窗口事件 $(window).resize(function () {widthChange();bodyChange();});