// 瀵艰埅 var nav = { throttle: function (func, delay) { // 鑺傛祦鍑芥暟 var run = true return function () { if (!run) { return false } run = false setTimeout(function () { func.apply(this, arguments) run = true }, delay || 500) } }, headerNavListen: function () { // 瀵艰埅js-鑺傛祦 var $header = $('header') var sTop = $(window).scrollTop() if (sTop > 80) { $header.addClass('head-active') } else { $header.removeClass('head-active') } $(document).scroll( nav.throttle(function () { sTop = $(window).scrollTop() if (sTop > 80) { $header.addClass('head-active') } else { $header.removeClass('head-active') } }, 100) ) }, getQueryVariable: function (variable) { // 鑾峰彇url鍙傛暟 var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return (false); }, } // 棣栭〉 var home = { banner: function () { var swiper = new Swiper('.banner-swiper .swiper-container', { loop: true, // autoplay: true, pagination: { el: '.banner-swiper .swiper-pagination' } }) }, // 浜у搧涓績 product: function () { $('.home-part-one-tab .tab-item').click(function () { var i = $(this).index('.home-part-one-tab .tab-item') // console.log(i); $('.home-part-one-tab .tab-item').removeClass('active') $(this).addClass('active') $('.home-part-one .content-item') .eq($(this).index() - 1) .addClass('show') .siblings() .removeClass('show') swiperArray(i) }) // 浜у搧涓績 var swiperArray = function (i) { var length = $('.home-part-one .my-container .content-item').length; var slideLength = $('.index-' + i + ' .product-list .swiper-container .swiper-slide').length; console.log(slideLength); if (slideLength < 4) { $('.navigation-box').hide() }else { $('.navigation-box').show() } var swiper = new Swiper('.index-' + i + ' .product-list .swiper-container', { slidesPerView: 3, navigation: { nextEl: '.navigation-box .swiper-button-next', prevEl: '.navigation-box .swiper-button-prev', }, }); } swiperArray(0) }, about: function () { // 鍚堜綔浼欎即 杞挱 var swiper = new Swiper('.partner-container', { slidesPerView: 6, spaceBetween: 50, slidesPerGroup: 6, autoplay: { delay: 3000, disableOnInteraction: false }, loop: true, pagination: { el: '.partner .swiper-pagination', clickable: true, } }) var swiper1 = new Swiper('.bg-color .swiper-container', { autoplay: { delay: 3000, disableOnInteraction: false }, loop: true, pagination: { el: '.bg-color .swiper-pagination', clickable: true, } }) }, // 鏂伴椈涓績榧犳爣绉诲叆绉诲嚭 news: function () { $('.news-main-right .news-list').mouseenter(function () { var newssrc = $(this).attr('data-src') console.log(newssrc) $('.news-main-left img').attr('src', newssrc) }) $('.news-main-right .news-list').mouseleave(function () { var newssrc1 = $('.news-main-right .news-list').attr('data-src') $('.news-main-left img').attr('src', newssrc1) }) }, // 鍚堜綔瀹㈡埛 customers: function () { var swiper1 = new Swiper('.customers-swiper .swiper-container', { autoplay: { delay: 3000, stopOnLastSlide: false, disableOnInteraction: false }, loop: true, pagination: { el: '.customers-swiper .swiper-pagination', clickable: true, } }) } } var about = { // 鍒嗗叕鍙 office: function () { $('.detail-left').hover( function () { $(this).find('.top-line').addClass('top-line-block') $(this).siblings().find('.top-line').removeClass('top-line-block') // $(this).parents('.about-office-detail').find('.about-office-detail-right').addClass('detail-right-block'); // $(this).parents('.about-office-detail').siblings().find('.about-office-detail-right').removeClass('detail-right-block'); $('.about-office-detail-right') .eq($(this).index()) .addClass('detail-right-block') .siblings() .removeClass('detail-right-block') }, function () { $('.detail-left').find('.top-line').removeClass('top-line-block') $('.detail-left').eq(0).find('.top-line').addClass('top-line-block') $('.about-office-detail-right').removeClass('detail-right-block') $('.about-office-detail-right').eq(0).addClass('detail-right-block') } ) }, // 鍚堜綔浼欎即 about: function () { // 鍚堜綔浼欎即 杞挱 var swiper = new Swiper('.partner-container', { slidesPerView: 6, spaceBetween: 50, slidesPerGroup: 6, autoplay: { delay: 3000, disableOnInteraction: false }, loop: true, pagination: { el: '.partner .swiper-pagination', clickable: true, } }) var swiper1 = new Swiper('.bg-color .swiper-container', { autoplay: true, loop: true, pagination: { el: '.bg-color .swiper-pagination' } }) }, // 鏂伴椈涓績榧犳爣绉诲叆绉诲嚭 news: function () { $('.news-main-right .news-list').mouseenter(function () { var newssrc = $(this).attr('data-src') console.log(newssrc) $('.news-main-left img').attr('src', newssrc) }) $('.news-main-right .news-list').mouseleave(function () { var newssrc1 = $('.news-main-right .news-list').attr('data-src') $('.news-main-left img').attr('src', newssrc1) }) }, // 鍚堜綔瀹㈡埛 customers: function () { var swiper1 = new Swiper('.customers-swiper .swiper-container', { autoplay: { delay: 3000, stopOnLastSlide: false, disableOnInteraction: false }, loop: true, pagination: { el: '.customers-swiper .swiper-pagination', clickable: true, } }) } } var solve = { // 鍖呰绾 pack: function () { $('.solve-pack').click(function () { $(this).addClass('solve-pack-current') $(this).siblings().removeClass('solve-pack-current') console.log($(this).index()) }) $('.content-top-video').click(function () { $('.video-box').fadeIn() }) $('.close').click(function () { $('.video-box').fadeOut() }) }, // 鐢熶骇绾 overview: function () { var mySwiper2 = new Swiper('#swiper-container2', { slidesPerView: 'auto', spaceBetween: 30, freeMode: true }) }, // 鏈哄櫒 machine: function () { $('.solve-machine-li').click(function () { if ( !$(this) .find($('.machine-li-bottom')) .hasClass('machine-li-bottom-block') ) { $(this) .find($('.machine-li-bottom')) .addClass('machine-li-bottom-block') $(this) .siblings() .find($('.machine-li-bottom')) .removeClass('machine-li-bottom-block') $(this).find($('.li-right-img')).addClass('li-right-img-current') $(this) .siblings() .find($('.li-right-img')) .removeClass('li-right-img-current') } else { $(this) .find($('.machine-li-bottom')) .removeClass('machine-li-bottom-block') $(this).find($('.li-right-img')).removeClass('li-right-img-current') } }) // 闈欐€佷骇鍝佸鐞 var pid = (solve.getQueryVariable('id')).toString(); $('.solve-machine ul li[data-pid=' + pid + ']').show(); // if (pid === '135') { // //瀹夌摽鐡跺寘瑁 // } else if (pid === '139') { // //閾濆娉$僵/閾濋摑鍖呰绾 // } else if (pid === '140') { // //鐗囧墏/鑳跺泭鍓傜摱瑁呯嚎 // } else if (pid === '132') { // //棰楃矑鍓傚寘瑁呯嚎 // } }, // 鑾峰彇url鍙傛暟 getQueryVariable: function (variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return (false); } } // 浜у搧 var product = { index: function () { var length = $('.home-part-one .my-container .content-item').length; for (var i = 0; i < length; i++) { var slideLength = $('.index-' + i + ' .product-right-list .swiper-container .swiper-slide').length; if (slideLength < 4) { $('.index-' + i + ' .product-right-navigation').hide() } var swiper = new Swiper('.index-' + i + ' .product-right-list .swiper-container', { slidesPerView: 3, navigation: { nextEl: '.index-' + i + ' .product-right .swiper-button-next', prevEl: '.index-' + i + ' .product-right .swiper-button-prev', }, }); } $('.solve-four-pack .solve-pack').click(function () { $(this) .addClass('solve-pack-current') .siblings() .removeClass('solve-pack-current') var key = $(this).attr('data-id') console.log(key) }) if (nav.getQueryVariable('id')) { $("html,body").animate({ scrollTop: 500 }, 0); } $('.detail-box-img').click(function () { var src = $(this).attr('data-src'); // console.log(src); $('.box-large-img').attr('src', src).fadeIn(150); $('.large-img-shadow').fadeIn(150); }) $('.large-img-shadow').click(function () { $('.box-large-img').fadeOut(150); $('.large-img-shadow').fadeOut(150); }) if (nav.getQueryVariable('data-id')) { var data = nav.getQueryVariable('data-id'); $('.solve-four-pack .solve-pack[data-id=' + data + ']').addClass('solve-pack-current').siblings().removeClass('solve-pack-current'); var elTop = $('.home-part-one .my-container .content-item[data-id=' + data + ']').offset().top; $("html,body").animate({ scrollTop: elTop - 150 }, 500); } $("img").each(function () { if (!$(this).attr("src")) { $(this).hide(); } }); $('.constitute-item-right').each(function () { if ($(this).children().length <= 0) { $(this).hide(); $('.constitute-item-left').addClass('left-margin') } }) } } var contact = { index: function () { var lock = false $('.submit-btn').click(function () { var name = $('.name').val() var phone = $('.phone').val() var company = $('.company').val() var message = $('.message').val() if (name === '') { alert('璇疯緭鍏ュ鍚?) return false } if (phone === '') { alert('璇疯緭鍏ユ墜鏈哄彿') return false } else if (!/^1[3456789]\d{9}$/.test(phone)) { alert('鎵嬫満鍙锋牸寮忎笉姝g‘') return false } if (company === '') { alert('璇疯緭鍏ュ叕鍙稿悕绉?) return false } if (message === '') { alert('璇风暀瑷€') return false } lock = true if (lock) { $.post( '/api/Form/FormSubmit', { Company: company, Mobile: phone, StoreName: name, Leaving: message }, function (data) { if (data.errcode === 0) { // alert('鎻愪氦鎴愬姛') $('.form-frame').addClass('frame-block') $('.form-shadow').show() $('.name').val('') $('.phone').val('') $('.company').val('') $('.message').val('') lock = false } else { alert(data.errmsg) } } ) } }) // 纭畾 鍏虫帀寮圭獥 $('.form-frame-true').click(function () { $('.form-frame').removeClass('frame-block') $('.form-shadow').hide() }) }, recruit: function () { $('.problem-list .item .title-box').click(function () { var self = $(this).children('.icon') var selfsiblings = $(this).parent().children('.content') var selfParent = $(this).parent().siblings().children('.content') var selfParentIcon = $(this).parent().siblings().find('.icon') if (!self.hasClass('active')) { selfsiblings.slideDown(150, function () { self.addClass('active') }) selfParent.slideUp(150, function () { selfParentIcon.removeClass('active') }) } else { selfsiblings.slideUp(150, function () { self.removeClass('active') }) } }) } }