/*****************/ function stopBubble(e) { // 如果传入了事件对象,那么就是非ie浏览器 if (e && e.stopPropagation) { //因此它支持W3C的stopPropagation()方法 e.stopPropagation(); } else { //否则我们使用ie的方法来取消事件冒泡 window.event.cancelBubble = true; } } var tap = "ontouchstart" in document ? "touchend" : "click"; var winWt = parseInt($(window).width()), winHt = parseInt($(window).height()); //实现滚动条无法滚动 var winHadntScroll = function(e) { e.preventDefault(); }; /***禁止滑动***/ function scrollStop() { var h = $(window).height(); document.body.style.overflow = "hidden"; document.addEventListener("touchmove", winHadntScroll, { passive: false }); //禁止页面滑动 } /***取消滑动限制***/ function scrollMove() { document.body.style.overflow = ""; //出现滚动条 document.removeEventListener("touchmove", winHadntScroll, { passive: false }); } /// 锚点跳转 function anchorMove(id, fn) { var $obj = $(id), moveFun = fn; var oh = $obj.offset().top - parseInt($(".header").outerHeight()); $("html,body").animate({ scrollTop: oh, }, 300, function() { if (moveFun) moveFun(); } ); } /// 竖向滚动条 if ($(".scrollbox").length > 0) { $(".scrollbox").mCustomScrollbar({ scrollInertia: 1000, advanced: { updateOnContentResize: true, }, }); } /// 横向滚动条 if ($(".scrollbox2").length > 0) { $(".scrollbox2").mCustomScrollbar({ axis: "x", mouseWheel: true, advanced: { updateOnContentResize: true, }, }); } // 页面滚动wow.js再ie9以上引用 var wow = new WOW({ boxClass: "wow", animateClass: "animated", offset: 100, mobile: true, live: true, }); if (!/msie [6|7|8|9]/i.test(navigator.userAgent)) { wow.init(); } // 模态框 $(".modal").on("shown.bs.modal", function() { $("body").addClass("modal-open"); }); $(".modal").on("hidden.bs.modal", function() { if ($(this).find("video").length) { var videoId = $(this).find(".video-js").attr("id"); var myplayer = videojs(videoId); myplayer.pause(); myplayer.currentTime(0); } }); $(".modal-close") .off(tap) .on(tap, function() { var $modal = $(this).parents(".modal"); $modal.modal("hide"); }); // 判断设备 var os = (function() { var ua = navigator.userAgent, isWindowsPhone = /(?:Windows Phone)/.test(ua), isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone, isAndroid = /(?:Android)/.test(ua), isIOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), isFireFox = /(?:Firefox)/.test(ua), isChrome = /(?:Chrome|CriOS)/.test(ua), isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)), isPhone = /(?:iPhone)/.test(ua) && !isTablet, isPc = !isPhone && !isAndroid && !isSymbian; return { isTablet: isTablet, isPhone: isPhone, isAndroid: isAndroid, isIOS: isIOS, isPc: isPc, }; })(); // 判断是否微信 function is_weixin() { var ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { return true; } else { return false; } } if (!os.isPc) { $("body").addClass("is-iphone"); } else { $("body").addClass("is-pc"); } if (os.isAndroid) { $("body").addClass("is-android"); } if (os.isIOS) { $("body").addClass("is-ios"); } if (is_weixin()) { $("body").addClass("is-wx"); } else { $("body").addClass("not-wx"); } // 单选框 $(".check-list label").on(tap, function() { $(this) .parent("li") .addClass("is-checked") .siblings() .removeClass("is-checked"); }); // 视频 $(".btn-open_video").on(tap, function() { $(".modal-video").modal("show"); }); $('[data-toggle="tab"]').on(tap, function() { var id = $(this).attr("href"), $lis = $(this).parent("li"); $(this).tab("show"); $lis.addClass("active").siblings().removeClass("active"); }); /******************************/ // PC端导航 $(".head-navlist > li").on("mouseenter", function() { $(this) .addClass("active") .find(".subnav-box") .stop(true, true) .slideDown(300) .end() .siblings("li") .removeClass("active") .find(".subnav-box") .hide(); // $('.header .had-subnav.activeD::after').hide() $(".head-navlist .navlv1").removeClass("hab-subnav activeX"); if ($(this).hasClass("had-subnav")) $(".header").addClass("open-subnav1"); }) .on("mouseleave", function() { $(this).removeClass("active").find(".subnav-box").hide(); $(".header").removeClass("open-subnav"); $(".head-navlist > li.current").addClass("active"); $(".head-navlist .activeW").addClass("activeX"); // $(this).find(".activeW").addClass("activeX"); }); // 鼠标经过页头事件 // 回到顶部 $('.backtop').hide(); $(window).scroll(function() { if ($(this).scrollTop() > 100) { $('.backtop').fadeIn(); } else { $('.backtop').fadeOut(); } }); $('.backtop').on('click', function() { $('html,body').animate({ 'scrollTop': '0' }) }) // 底部技术支持 if ($('.foot-jszc_swip').length) { var footJsSwip = new Swiper('.foot-jszc_swip', { direction: 'vertical', spaceBetween: 30, autoplay: { delay: 2000, disableOnInteraction: false, }, loop: true, observer: true, observeParents: true, }); } // $(".header").on("mouseover", function() { // $('body').addClass('head-white') // }) // $(".header").on("mouseleave", function() { // $('body').removeClass('head-white') // }) // 导航 // $(window).scroll(function() { // if ($(window).scrollTop() > 0) { // $('body').addClass('head-white'); // $(".header").on("mouseleave", function() { // $('body').addClass('head-white') // }) // } else if ($(window).scrollTop() < 2) { // $('body').removeClass('head-white'); // $(".header").on("mouseleave", function() { // $('body').removeClass('head-white') // }) // } // }) // if ($(window).scrollTop() == 0) { // $('body').removeClass('head-white'); // } // $('.nav-rightbox .searchbox').on('click', function() { // $('.search-box').slideToggle(); // $('.bbg1').toggleClass('blackbgShow'); // if ($(window).scrollTop() == 0) { // $('.header').toggleClass('head-white1'); // } // }) var windowWidth = $(window).width() // 搜索栏 $('.gg-search').on('click', function(e) { $('.search-box').slideToggle(300, 'linear'); stopBubble(e) // e.stopPropagation(); // e.preventDefault(); // $('.ph-nav-box').removeClass('on') // $('.ph-nav-box').removeClass('on') // $('.head-menu_open').removeClass('on') // $('.head-menu_open').removeClass('open') $('body').toggleClass("head-white1") $('.ph-nav-box').removeClass('on') $('.ph-nav-box').removeClass('open') $('.head-menu_open').removeClass('on') $('.head-menu_open').removeClass('open') $('body').toggleClass("head-white-s") $('body').removeClass("head-white-c") $('body').removeClass("open") // $('body').css('overflow', 'inherit') }) // $('.gg-search1').on('click', function(e) { // $('.search-box').slideToggle(300, 'linear'); // e.stopPropagation(); // e.preventDefault(); // $('.ph-nav-box').removeClass('on') // $('.ph-nav-box').removeClass('on') // $('.head-menu_open').removeClass('on') // $('.head-menu_open').removeClass('open') // $('body').toggleClass("head-white-s") // $('body').removeClass("head-white-c") // }) // $('.head-menu_open').on('click', function() { // $('body').toggleClass("head-white1") // if ($('body').find('.head-white1')) { // $('body').addClass("head-white1") // } // }) // 搜索框冒泡 $(document).on('click', function(e) { $('.search-box').slideUp(300, 'linear'); $('body').removeClass("head-white1") $('body').removeClass("head-white-s") }) $('.search-box .global-inner').on('click', function(e) { e.stopPropagation(); e.preventDefault(); }) // 移动端导航 $(".head-menu_open").on('click', function() { // $('body').toggleClass("head-white1") $('body').toggleClass("open") $(this).toggleClass("open") $(".ph-nav-box").toggleClass("on"); // if ($(this).hasClass("open")) { // scrollStop(); // } else { // scrollMove(); // } if ($('body').hasClass('head-white1')) { $('body').addClass('head-white1') } else { $('body').removeClass('head-white1') } // $('body').toggleClass("head-white1") $('body').toggleClass('head-white-c') $('body').removeClass('head-white-s') }); $('.headItem').click(function() { $(this).find('.headB').stop(true).slideToggle(200) }) $(".ph-nav-box .lvbox").each(function() { $(this).siblings(".lv").find("em").show(); }); $(".lv1 em").on('click', function() { $(this).parents(".lv1").toggleClass("on").end() .parents(".lv1").siblings(".lv2box").stop(true, true).slideToggle(300).end() .parent("li").siblings().find(".lvbox").slideUp(300).siblings(".lv").removeClass("on"); }); $(".lv2 em").on('click', function() { $(this).parents(".lv2").toggleClass("on").end() .parents(".lv2").siblings(".lv3box").stop(true, true).slideToggle(300).end() .parents(".item").siblings().find(".lvbox").removeClass("on").slideUp(300).siblings(".lv").removeClass("on"); }); $(".lv3 em").on('click', function() { $(this).parents(".lv3").toggleClass("on").end() .parents(".lv3").siblings(".lv4box").stop(true, true).slideToggle(300).end() .parents(".item").siblings().find(".lvbox").slideUp(300).siblings(".lv").removeClass("on"); }); /*** 公共 ****/ // 新面包屑手机端 if ($(".crumbs-new .box-mob .item-list").length) { $('.crumbs-new .box-mob .icon').on(tap, function(e) { $('body').toggleClass('mobCrumbs') $('.crumbs-new .box-mob .item-list').stop(true).slideToggle() e.stopPropagation(); }) $(document).on(tap, function() { $('.crumbs-new .box-mob .item-list').slideUp() $('body').removeClass('mobCrumbs') }); } $('.foot-t1 .list .items').on('click', function() { $(this).find('.lv3').slideToggle(); $(this).siblings().find('.lv3').slideUp(); $(this).toggleClass('active').siblings().removeClass('active'); }); // 公共筛选产品 $(function() { var $all = $('.checkPremise-all'); var $item = $('.checkPremise'); $all.click(function() { if ($(this).prop('checked')) { $item.prop('checked', true); } else { $item.prop('checked', false); } }); $item.click(function() { var index = $item.index(this) if ($(this).prop('checked')) { var allTrue = true; $item.each(function(i) { if (index != i) { if (!$(this).prop('checked')) { allTrue = false; } } }); if (allTrue) { $all.prop('checked', true); } } else { $all.prop('checked', false); } }) }) $(".footer .foot-t2 .top .official .item").on('click', function(e) { $(this).find(".pop-img-box").show() e.stopPropagation(); }) $(".footer .foot-t2 .top .pop-img-box").on('click', function(e) { e.stopPropagation(); $(this).css('display', 'none') }) $(".pop-img").on('click', function(e) { e.stopPropagation(); }) // 筛选框下拉 $('.p-produce-index .public-area .nav-left .choose .name').on('click', function() { $(this).parent().find('.choose-list').slideToggle(); $(this).parent().siblings().find('.choose-list').slideUp(); $(this).parent().toggleClass('active').siblings().removeClass('active'); }); $('.p-produce-index .nav-right .choose .name').on('click', function() { $(this).parent().find('.choose-list-box').slideToggle(); $(this).parent().siblings().find('.choose-list-box').slideUp(); $(this).parent().toggleClass('active').siblings().removeClass('active'); }); // 四级导航 var fourSwiper = new Swiper(".four-nav-swiper", { breakpoints: { 0: { slidesPerView: 'auto', spaceBetween: 24, // width:'' }, 992: { slidesPerView: 6, // spaceBetween: 24, spaceBetween: 0, }, }, navigation: { nextEl: ".four-nav-swiper-next", prevEl: ".four-nav-swiper-prev", }, }); if ($('.four-nav-swiper').length) { fourSwiper.slideTo($('.four-nav-swiper .active').index(), 1000, false); //切换到第一个slide,速度为1秒 } // 发展历程 var historySwiper = new Swiper(".history-swiper", { loop: true, loopAdditionalSlides: 1, grabCursor: true, speed: 1500, autoplay: { delay: 0, disableOnInteraction: true, stopOnLastSlide: false, }, observer: true, observeParents: true, breakpoints: { 0: { slidesPerView: 2, }, 992: { slidesPerView: 4, spaceBetween: 0, }, }, pagination: { el: ".history-swiper-pagination", type: "progressbar", }, }); historySwiper.el.onmouseover = function() { historySwiper.autoplay.stop(); } historySwiper.el.onmouseout = function() { historySwiper.autoplay.start(); } // 投资建设与服务 $('.history-swiper .item-slide').mouseover(function() { $(this).addClass('active').siblings().removeClass('active') }) if ($(".public-area .nav-left .choose .items-list").length > 0) { // var chooseLength = $(".items-list .choose-list").length // console.log(chooseLength); // if (chooseLength === 0) { // $(".choose-list").parent().find('.bi').hide() // } // $(".public-area .nav-left .choose .items-list").on('click', function() { // console.log(this); // if ($(this).find(".choose-list")) { // $(this).toggleClass('we1') // } // }) $(".public-area .nav-left .choose .items-list").find(".choose-list").hide() } $(".public-area .nav-left .choose .choose-list").show() // 三级导航 var windowWidth = $(window).width() if (windowWidth > 991.98) { if ($(".three-nav .item").length > 0) { var threeNav = $(".three-nav .item").length // console.log(threeNav); if (threeNav == 2) { $(".three-nav .item").css('width', '50%') } if (threeNav == 3) { $(".three-nav .item").css('width', '33.33%') } if (threeNav == 4) { $(".three-nav .item").css('width', '25%') } } } // 团队个人简介 $('.team .list .item').on('click', function() { // console.log('123'); $(this).toggleClass('active') $(this).siblings().removeClass('active') var listWidth = $(".team .list").width() - 40 $(".team .figure").css('width', listWidth) var figureOffset = $(this).offset().left - $('.team .list').offset().left $(this).find(".figure").css('margin-left', -figureOffset + 'px') if (windowWidth <= 991.98) { var Oleft = ($('.team .list').offset().left) / 2 console.log(Oleft); var figureOffset1 = $(this).offset().left - Oleft $(this).find(".figure").css('margin-left', -figureOffset1 + 'px') } }) // 问题咨询 window.onload = function() { $('.channel31 .list .item').on('click', function() { $(this).find('.reply').slideToggle(); $(this).siblings().find('.reply').slideUp(); $(this).toggleClass('channel31-active').siblings().removeClass('channel31-active'); }); } // 新增公司 var addswiper = new Swiper('.addswiper', { slidesPerView: 1, autoplay: true, pagination: { el: '.addswiper-pagination', clickable: true, }, }); // 编辑器追加表格外层 // $(".editor-content2 table").append() $(".editor-content2 table").wrap("
")