//banner大图 var banner_swiper = new Swiper('.banner-imgbox', { slidesPerView: 1, autoplay: { delay: 5000, disableOnInteraction: false, },//自动滚动 loop: true, autoHeight: true, pagination: { el: '.swiper-pagination', clickable: true, }, navigation: { nextEl: '.banner-next', prevEl: '.banner-prev', }, }); $(document).ready(function () { // 导航on效果 (function(){ var s = location.href; $(".nav>li>a").each(function(index, el) { var $this = $(this); if ( s.indexOf( $this.attr("href").split(".")[0] ) >= 0 ){ $this.parent().addClass('nav-this'); } }); })(); // 导航下拉 $(".nav>li").hover(function() { if($(this).find("ul").length > 0){ $(this).children("ul").stop(false).slideDown(300) } },function() { $(this).children("ul").stop(false).slideUp("fast"); }); // PC导航定位 var topbox_height = $(".topbox").outerHeight(); var header_height = $(".header").outerHeight(); $(".topbox").css("margin-bottom", header_height); $(".header").css("top", topbox_height); $(window).scroll(function () { if ($(this).scrollTop() > topbox_height) { $(".header").css({ "top": "0", }); $(".header").addClass("header_active"); } else { $(".header").css({ "top": topbox_height, }); $(".header").removeClass("header_active"); } }) // 手机导航定位 if (screen.width < 991) { $(".topbox").css("margin-bottom", header_height); $(".header").css({ "margin-bottom": "0", "top": topbox_height, }); $("nav").css("top", "0"); $(window).scroll(function () { if ($(this).scrollTop() > topbox_height) { $(".header").css({ "position": "fixed", "top": "0", }); $("nav").css({ "position": "fixed", "top": "0", }); } else { $(".header").css({ "position": "absolute", "top": topbox_height, }); $("nav").css({ "position": "fixed", "top": "0", }); } }) } if (screen.width < 767) { $("body").css("padding-top", header_height); //手机标题 $(".about_title").click(function () { $(".about_ul").slideToggle("slow"); }); } //合作伙伴 var coop_swiper = new Swiper('.coop-imgbox', { autoplay: { delay: 5000, disableOnInteraction: false, },//自动滚动 loop: false, //循环滚动 slidesPerView: 3, //个数 spaceBetween: 5, //间距 slidesPerColumn : 2, //显示2排 slidesPerColumnFill : 'row', //两排布局 breakpoints: { 1200: { slidesPerView: 6, spaceBetween: 12, }, 1024: { slidesPerView: 5, }, 767: { slidesPerView: 4, } } }); // 保洁常识 $('.news_nav li').hover(function () { $(this).addClass('news_actived').siblings('li').removeClass('news_actived'); var index = $(this).index(); $('.news_contect .news_box').eq(index).show().siblings('.news_contect .news_box').hide(); }) // 设备展示 var Equ_swiper = new Swiper('.Equ-imgbox', { autoplay: { delay: 5000, disableOnInteraction: false, },//自动滚动 loop: false, //循环滚动 slidesPerView: 2, //个数 spaceBetween: 5, //间距 breakpoints: { //横向平板 1200: { slidesPerView: 4, spaceBetween: 20, }, 1024: { slidesPerView: 4, spaceBetween: 15, }, 767: { slidesPerView: 3, spaceBetween: 10, } } }); // 左侧多层下拉 // $("li").has("ul").mouseover(function(){ // $(this).children("ul").css("display","block"); // }).mouseout(function(){ // $(this).children("ul").css("display","none"); // }) $(".about_ul>li").hover(function() { if($(this).find("dl").length > 0){ $(this).children("dl").stop(false).slideDown(300) } },function() { $(this).children("dl").stop(false).slideUp("fast"); }); //手机导航 $(".icon-menu").click(function () { if($(this).hasClass("icon-menu-active")){ $(this).removeClass("icon-menu-active"); $("nav").removeClass("nav-actived"); }else{ $(this).addClass("icon-menu-active"); $("nav").addClass("nav-actived"); } }); //手机底部组件 // 电话 $(".root .phone").click(function () { $(".root_bj").fadeIn(); $(".root_phone").slideDown(); }) $(".root_off").click(function () { $(".root_bj").fadeOut(); $(".root_phone").slideUp(); }) $(".root_bj").bind("click",function(e){ var target = $(e.target); if(target.closest(".root_phone").length == 0){ $(".root_bj").fadeOut(); $(".root_phone").slideUp(); // alert("已复制好,可贴粘。"); }     }) // 微信号 $(".wecht_btn").click(function () { $(".wecht-box").fadeIn(); }) $(".wecht_off").click(function () { $(".wecht-box").fadeOut(); }) $(".wecht-box").bind("click",function(e){ var target = $(e.target); if(target.closest(".wecht").length == 0){ $(".wecht-box").fadeOut(); }     }) $(".wecht_btn").on("click", function () { let str = $(this).next(".wecht-box").find("#copytxt").text(); //拿到li标签内的文本 let input = ``; $("body").append(input); //放入document $("#temp").select(); //选中输入框的文本,目前只有input和textarea支持,注意要复制的标签不能隐藏(display: none;) document.execCommand("Copy"); //执行document的复制 $("#temp").remove(); //用完就扔 }) }); // 返回顶部 // $(".footer_btn a").click(function() { // $('body,html').animate({ // scrollTop: 0 // },1000); // return false; // }); // 锚链接 // $('.nav>li>a').click(function(){ // $('html,body').animate({scrollTop: ($($(this).attr('href')).offset().top - 0 )},1000); // });