$(function () { var mobFJ = { defInit: function (tar) { if (tar && tar.length != 0) { $(".mob-backtop").on("click", function () { $("body,html").animate({ scrollTop:0 }); }); $(".mob-catlog-news-toggle").on("click", function () { $(this).toggleClass("mob-catlog-arr"); $(this).next().toggle(300); }); $("#hr-search-href-mob").on("click", function () { searchFlag = 0; var defHref = $("#hr-search-href-mob").attr("href"); var args = "siteId=" + window.btoa($("#hr-search-href-mob").attr("data-siteId")) + "&siteIds=" + window.btoa($("#hr-search-href-mob").attr("data-siteIds")) + "&excludeCategoryId=" + window.btoa($("#hr-search-href-mob").attr("data-excludeCategoryId")) + "&platform=" + window.btoa($("#hr-search-href-mob").attr("data-source")) + "&column=" + window.btoa($("#hr-search-href-mob").attr("data-plate")) + "&keyword=" + encodeURI(encodeURI($.trim($("#searchword3").val()))); $("#hr-search-href-mob").attr("href", defHref + '#' + args); $("#searchword3").val(""); $(".icon-guanbi").trigger("click"); }); } }, footerQrcode: function (tar) { if (tar && tar.length != 0) { tar.each(function (index) { $(this).on("click", function () { $(".mob-footer-call-wrap .wrap").hide(); $(".mob-footer-call-wrap .wrap").eq(index).show(); }); }); $(".mob-call-href").blur(function (e) { $(".mob-footer-call-wrap .wrap").hide(); }); $(".mob-footer-big").on("click", function () { $(this).toggleClass("mob-footer-open"); $(this).next().slideToggle(); }); } }, mobSearch: function (tar) { if (tar && tar.length != 0) { tar.on("click", function () { $(this).toggleClass("icon-guanbi"); $(".mob-search-cont").toggle(); }); $(".mob-catlog-ico").on("click", function () { $(".mob-catlog").slideDown(); $("html,body").addClass("overhidden"); }); $(".mob-catlog-close").on("click", function () { $(".mob-catlog").slideUp(); $("html,body").removeClass("overhidden"); }); } }, mobProTop: function (tar) { var mySwiper = new Swiper('.prod-mob-top', { noSwiping: true, breakpoints: { 300: { //褰撳睆骞曞搴﹀ぇ浜庣瓑浜?20 slidesPerView: 4, }, 750: { //褰撳睆骞曞搴﹀ぇ浜庣瓑浜?50 slidesPerView: 4, }, }, on: { init: function () { $(".prod-mob-top .num").eq(0).addClass("prod-sel"); $(".prod-mob-wrap").eq(0).show(); $(".pro-mob-prev").addClass("prod-dis"); mobFJ.mobProBot(".prod-mob-bot0", 0); var flag = 0, len = $(".prod-mob-item .num").length; $(".pro-mob-next").on("click", function () { //鍚戝悗鐐圭殑鏃跺€ if (len > flag+1) { flag++; $(".prod-mob-top .num").removeClass("prod-sel"); $(".prod-mob-top .num").eq(flag).addClass("prod-sel"); $(".pro-mob-prev").removeClass("prod-dis"); $(".prod-mob-wrap").hide(); $(".prod-mob-wrap").eq(flag).show(); mySwiper.slideTo(flag); var mySwiperbot = new Swiper(".prod-mob-bot"+flag, { slidesPerView: 1, watchOverflow: true, observer: true, observeSlideChildren: true, observeParents: true, pagination: { el: '.swiper-pagination' + flag, clickable :true, }, }); if (len == flag + 1) { $(".pro-mob-next").addClass("prod-dis"); return false; } } else { $(".pro-mob-next").addClass("prod-dis"); } }); $(".pro-mob-prev").on("click", function () { //鍚戝墠鐐圭殑鏃跺€ if (flag > 0) { flag--; var mySwiperbot = ""; $(".prod-mob-top .num").removeClass("prod-sel"); $(".prod-mob-top .num").eq(flag).addClass("prod-sel"); $(".pro-mob-next").removeClass("prod-dis"); $(".prod-mob-wrap").hide(); $(".prod-mob-wrap").eq(flag).show(); mySwiper.slideTo(flag); // mySwiperbot = new Swiper(".prod-mob-bot"+flag, { // slidesPerView: 1, // watchOverflow: true, // observer: true, // observeSlideChildren: true, // observeParents: true, // pagination: { // el: '.swiper-pagination' + flag, // clickable :true, // }, // }); if (flag == 0) { $(".pro-mob-prev").addClass("prod-dis"); // var mySwiperbot = new Swiper(".prod-mob-bot"+flag, { // slidesPerView: 1, // watchOverflow: true, // observer: true, // observeSlideChildren: true, // observeParents: true, // pagination: { // el: '.swiper-pagination' + flag, // clickable :true, // }, // }); return false; } } else { $(".pro-mob-prev").addClass("prod-dis"); } }); $(".prod-mob-top .num").each(function (index) { $(this).on("click", function () { flag = index; $(".prod-mob-wrap").hide(); $(".prod-mob-wrap").eq(flag).show(); $(".prod-mob-top .num").removeClass("prod-sel"); $(".prod-mob-top .num").eq(flag).addClass("prod-sel"); mySwiper.slideTo(flag); var mySwiperbot = new Swiper(".prod-mob-bot"+flag, { slidesPerView: 1, watchOverflow: true, observer: true, observeSlideChildren: true, observeParents: true, pagination: { el: '.swiper-pagination' + flag, clickable :true, }, }); }); }); } }, pagination: { el: '.prod-mob-top .swiper-pagination', }, }) }, mobProBot: function (tar,index) { if (tar && tar.length != 0) { var mySwiperbot = new Swiper(tar, { slidesPerView: 1, watchOverflow: true, observer: true, observeSlideChildren: true, observeParents: true, pagination: { el: '.swiper-pagination' + index, clickable :true, }, }); } }, mobHonor: function (tar) { if (tar && tar.length != 0) { var radialObj = $('#rad-mob-recyle').radialIndicator( { initValue: 10, barWidth: 2, maxValue:$(".honor-mob-item").length*10, barColor: '#E2332E', radius: 76, displayNumber: false }).data('radialIndicator'); var mySwiper = new Swiper('.honor-mob-swiper', { slidesPerView: 1, loop:true, direction: 'vertical', on: { init: function () { }, slideChange: function () { radialObj.animate((this.realIndex+1)*10); if (this.activeIndex != 0) { } else { } $(".honor-mob-item").hide(); $(".honor-mob-item").eq(this.realIndex).fadeIn(); } }, }); $(".honor-mob-swiper .swiper-slide a").eq(0).addClass("active"); $(".honor-mob-item").eq(0).show(); } }, fuwuSwiper: function (tar) { if (tar && tar.length != 0) { var mySwiper = new Swiper('.service-mob-swiper', { slidesPerView: 'auto', spaceBetween: 20 }); $(".service-mob-item").eq(0).show(); $(".service-mob-top .swiper-slide > div").each(function (index) { $(this).on("click", function () { $(".service-mob-top .swiper-slide > div").removeClass("active"); $(this).addClass("active"); $(".service-mob-item").hide(); $(".service-mob-item").eq(index).show(); }); }); } }, catlogSwiper: function (tar) { if (tar && tar.length != 0) { var mySwiper = new Swiper(tar, { slidesPerView: 'auto' }); $(document).scroll(function (e) { if ($(this).scrollTop() > 200) { $(".catlog-nav").addClass("catlog-fixed"); } else { $(".catlog-nav").removeClass("catlog-fixed"); if ($(this).scrollTop() < 150) { } } }); $(".catlog-nav a").each(function (index) { $(this).on("click", function () { if ($(this).attr("data-id") == "categories" || $(this).attr("data-id") == "quality" || $(this).attr("data-id") == "pro_knowledge") { $('html, body').animate({ scrollTop: $('#' + $(this).attr("data-id")).offset().top - 80 }, 500); } else if ($(this).attr("data-id") == "pro_honor") { $('html, body').animate({ scrollTop: $('#product_honors_mob').offset().top - 80 }, 500); } else { $('html, body').animate({ scrollTop: $('#' + $(this).attr("data-id")).offset().top - 40 }, 500); } }); }); } } } function init(tar) { if (tar && tar.length != 0) { mobFJ.defInit($(".mob-header")); mobFJ.footerQrcode($(".mob-call-href")); mobFJ.mobSearch($(".mob-search-ico")); mobFJ.mobProTop($(".prod-mob-top")); mobFJ.mobHonor($(".honor-mob-swiper")); mobFJ.fuwuSwiper($(".service-mob-swiper")); mobFJ.catlogSwiper($(".catlog-swiper")); } } init($(".mob-header")); });