$(function () { wowInt(); findTel(); phoneTargetSelf(); search(); Nav(); fontChange(); slider_nav(); Select(); Reset(); $(window).resize(); if ($(window).width() > 767) { ScollText(".team_indert p"); } $(".header_re").on('touchmove', function (event) { event.preventDefault(); event.stopPropagation(); }) if ($(".stock").length > 0) { var stockSwiper = new Swiper('.stock .swiper-container', { slidesPerView: 1, effect: 'slide', // autoplay: 5000, speed: 1000, loop: true, direction: 'vertical', noSwiping: true, }) var test2 = setInterval(function () { stockSwiper.slideNext(); }, 5000); // $(".stock").hover(function(){ // clearInterval(test2); // },function(){ // test2 = setInterval(function () { // stockSwiper.slideNext(); // }, 5000); // }) } if ($(window).width() > 1024) { $(".nav_p").each(function () { var num = $(this).parents("li").offset(); var num02 = num.left $(this).attr("style", 'margin-left:' + num02 + '' + "px") }) } }) function Nav () { $(window).scroll(function () { if ($(this).scrollTop() > 0) { $('body').addClass('scrollHeader'); } else { $('body').removeClass('scrollHeader'); } }); $(".nav_phone_btn").click(function () { $(this).toggleClass("visible_nav"); $("body").toggleClass("navbody"); }) if ($(window).width() > 1024) { $(".header .nav>ul>li").hover(function () { $(this).find(".nav_list").stop().slideDown(); }, function () { $(this).find(".nav_list").stop().slideUp(); }) } else { $(".nav>ul>li>i").click(function () { $(this).parent("li").addClass("cur"); $(this).parent("li").siblings().removeClass("cur"); }) } $(".return_a").click(function () { $(this).parents("li").removeClass("cur").siblings().removeClass("cur"); }) } function search () { $('.search_btn').click(function (e) { e.preventDefault(); e.stopPropagation(); $(this).toggleClass('on'); $(this).siblings('.search_box').toggleClass('on'); }) $('.search_box').click(function (e) { e.preventDefault(); e.stopPropagation(); }) $(document).click(function () { $('.search_btn').removeClass('on'); $('.search_box').removeClass('on'); }) } function ScollText (obj) { if ($(obj).length > 0) { $(obj).mCustomScrollbar({ mouseWheelPixels: 500, autoDraggerLength: false, advanced: { autoScrollOnFocus: "" } }); } } function Select () { $(".year_select").each(function (i) { $(this).find("dt").click(function (e) { if ($(this).hasClass('on_o')) { $(this).removeClass('on_o'); } else { $(this).addClass('on_o'); } e.preventDefault(); e.stopPropagation() $(".year_select").eq(i).find("dd a").each(function (x) { $(this).click(function () { $(".year_select").eq(i).find("dd a").removeClass("on") $(this).addClass("on") $(".year_select").eq(i).find("dt p").text($(this).text()); }) }) }) }) $(document).click(function () { $(".year_select dd").slideUp(); $(".year_select dt").removeClass('on_o'); }) $(".year_select dt").on("click", function (e) { if ($(this).siblings(".year_select dd").is(":hidden")) { $(this).siblings(".year_select dd").slideDown(); $(this).parents(".year_select").siblings(".year_select").children(".year_select dd").slideUp(); $(this).parents(".year_select").siblings(".year_select").children("dt").removeClass("on_o"); } else { $(this).siblings(".year_select dd").slideUp(); } }); } function wowInt () { if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: false, live: true }); wow.init(); }; } //wow 同一行 元素延迟加载 function wowDelay (box, row, delayTime) { $(box).children().each(function (index) { for (var i = 0; i < row; i++) { if (index % row == i) { $(this).attr("data-wow-delay", i * delayTime + 's'); }; }; }); }; // $(function(){ // wowInt(); // wowDelay(".list ul",$('.list ul li').length,"0.2") // }) /*手机端链接改为本窗口打开*/ function phoneTargetSelf (context) { if ($(window).width() < 1024) { if (context == undefined) { context = $(document); } $('a', context).each(function () { var target = $(this); var link = target.attr('target'); target.attr('target', '_self'); }) } } /*电话链接取消默认事件并添加样式*/ function findTel (context) { if ($(window).width() > 1024) { var condition = /^tel\:([0-9\-]+)|tel\:\+([0-9\-]+)$/; if (context == undefined) { context = $(document); } $('a', context).each(function (index, el) { var target = $(this); var href = target.attr('href'); if (condition.test(href)) { target.addClass('tel_link'); target.on('click', function (event) { event.preventDefault(); }) } }); } } function fontChange () { if ($(window).width() > 1024) { $(".edit_con_original").css('font-size', '16px') $(".font_size a").click(function () { $(this).addClass("on").siblings().removeClass("on"); }) $("#big").click(function () { $(".edit_con_original").css('font-size', '18px') }) $("#middle").click(function () { $(".edit_con_original").css('font-size', '16px') }) $("#small").click(function () { $(".edit_con_original").css('font-size', '14px') }) } else { $(".edit_con_original").css('font-size', '14px') $(".font_size a").click(function () { $(this).addClass("on").siblings().removeClass("on"); }) $("#big").click(function () { $(".edit_con_original").css('font-size', '16px') }) $("#middle").click(function () { $(".edit_con_original").css('font-size', '14px') }) $("#small").click(function () { $(".edit_con_original").css('font-size', '12px') }) } } function slider_nav () { if ($(window).width() <= 767) { // 01 if ($(".pub_title li").length > 4) { var brand3Swiper01 = new Swiper('.pub_title .swiper-container', { slidesPerView: 4, slidesPerGroup: 1, spaceBetween: 0, prevButton: '.pub_title .swiper-button-prev', nextButton: '.pub_title .swiper-button-next', onInit: function (swiper) { var i = $('.pub_title .swiper-slide.on').index(); swiper.slideTo(i - 1, 0) }, breakpoints: { } }) $(".pub_title .but").show(); } else { $(".pub_title").addClass("on") $(".pub_title .but").hide(); } } } function Reset () { $(".staff_btn .btn_02").click(function () { // $(".staff_form input,.staff_form textarea").val("") location.reload() }) $(".formBtn .resetBtn").click(function () { $(".radioChoose_i").removeClass("on"); $(".radioChoose_i").eq(0).addClass("on"); // $(".countusFrom_c input,.countusFrom_c textarea").val("") location.reload() }) } $(function () { var title_top = $('.pub_title').offset().top; $(window).scroll(function () { // 移动导航跟随 if ($(this).scrollTop() >= title_top) { $('.pub_title').addClass('xmn_pub_title') $('.pub_title .but div').addClass('xmn_btn') } else { $('.pub_title').removeClass('xmn_pub_title') $('.pub_title .but div').removeClass('xmn_btn') } }) })