var shutime = { percent: 0, timers: "", init: function(e) { $("body").append('

'); $('#nav-icon2').click(function() { $(this).toggleClass('open'); $(".nav").toggleClass("active"); }); $(window).scroll(function() { var scrollTop = $(window).scrollTop(); if (scrollTop > 0) { $(".header").addClass("active") } else { $(".header").removeClass("active") } }); $(".header").hover(function(){ $(".header").addClass("open") },function(){ $(".header").removeClass("open") }) var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 100, mobile: true, live: true }).init(); // shutime.common_scroll(); }, common_scroll: function() { const scroller = new LocomotiveScroll({ el: document.querySelector("[data-scroll-container]"), smooth: true, tablet: { breakpoint: 0 } }); scroller.on("scroll", function(ins) { if (ins.scroll.y > 0) { $(".header").addClass("active"); } else { $(".header").removeClass("active"); } if (ins.scroll.y > 100) { $(".backTop").addClass("active"); } else { $(".backTop").removeClass("active"); } if($(".subBanner").length > 0){ $(".subBanner").css({"-webkit-transform": "translateY(" + ins.scroll.y * 0.5 + "px)"}) } if($(".custom").length > 0){ var dpsl = new CountUp("huoban", 0, 300, 0, 2.5); if (ins.currentElements.huoban) { if (ins.currentElements.huoban.progress > 0.2) { dpsl.start(); } } } }); window.onload = function() { scroller.update(); } // 鐩戝惉椤甸潰楂樺害鍙樺寲 const containerId = document.querySelector('[data-scroll-container]'); let MutationObserver = window.MutationObserver || window.webkitMutationObserver || window.MozMutationObserver; let recordHeight = 0; const mutationObserver = new MutationObserver(function (mutations) { let height = window.getComputedStyle(containerId).getPropertyValue('height'); if (height === recordHeight) { return; } recordHeight = height; scroller.update() }) mutationObserver.observe(containerId, { childList: true, // 瀛愯妭鐐圭殑鍙樺姩锛堟柊澧炪€佸垹闄ゆ垨鑰呮洿鏀癸級 attributes: true, // 灞炴€х殑鍙樺姩 characterData: true, // 鑺傜偣鍐呭鎴栬妭鐐规枃鏈殑鍙樺姩 subtree: true // 鏄惁灏嗚瀵熷櫒搴旂敤浜庤鑺傜偣鐨勬墍鏈夊悗浠h妭鐐 }) scrollTaget(); function scrollTaget(){ var hash = window.location.hash; var pos = hash.substring(hash.indexOf('#') + 1); if (pos != ''){ scroller.scrollTo("#"+pos+"",{offset:-50}); } $(".header").removeClass('open'); } if($(".vr_box").length > 0){ $(".secondLab4 a").click(function(){ setTimeout(function(){ scrollTaget(); },10) }) } if($(".hr").length > 0){ $(".secondLab5 a").click(function(){ setTimeout(function(){ scrollTaget() },10) }) } if($(".custom").length > 0){ $(".secondLab6 a").click(function(){ setTimeout(function(){ scrollTaget() },10) }) } }, form: function() { $(".submit").click(function() { if ($(this).hasClass("active")) return; if ($(".userName").val() == "") { $(".submit").removeClass("active"); shutime.toast('璇疯緭鍏ユ偍鐨勫鍚?, false); return; } if ($(".userTel").val() == "") { $(".submit").removeClass("active"); shutime.toast('璇疯緭鍏ユ偍鐨勭數璇?, false); return; } else if (!shutime.regPhone($(".userTel").val())) { $(".submit").removeClass("active"); shutime.toast('鐢佃瘽鍙风爜鏍煎紡閿欒', false); return; } if ($(".userCity").val() == "") { $(".submit").removeClass("active"); shutime.toast('璇疯緭鍏ユ偍鐨勫煄甯?, false); return; } if ($(".userMsg").val() == "") { $(".submit").removeClass("active"); shutime.toast('璇疯緭鍏ユ偍鐨勭暀瑷€', false); return; } $(".submit").addClass("active"); $.post("/apiform.html", { form: "form", name: $(".userName").val(), phone: $(".userTel").val(), address: $(".userCity").val(), content: $(".userMsg").val(), _csrf: $("#_csrf").val() }, function(data) { if (data.code == "200") { shutime.toast('鎻愪氦鎴愬姛锛屾垜浠細灏藉揩鍜屾偍鑱旂郴', true); } else { shutime.toast(data.message, false); $(".submit").removeClass("active"); } }) }) }, getcity: function(city) { var value = []; var objs = $("input[class='currentValue']"); for (var i = 0; i < objs.size(); i++) { value.push(objs.eq(i).val()); } // alert(value.join(',')); return (value.join(',')) }, index: function() { var imgArr = []; var img = []; $(".bannerSwiper .pic").each(function() { imgArr.push($(this).attr("data-img")) }) var imgTotal = imgArr.length; var loadNum = 0; for (var i = 0; i < imgTotal; i++) { img[i] = new Image() img[i].src = imgArr[i] img[i].onload = function() { loadNum++; if (loadNum == imgTotal) { TweenMax.to('.jslogo', 1, { y: 10, opacity: 0, ease: Expo.easeOut }); TweenMax.staggerTo(".jsloading", 1, { y: 100 + "%", ease: Expo.easeInOut }, 0.05); // var swiper3 = new Swiper(".bannerSwiper", { // grabCursor: true, // speed:500, // autoplay: { // delay: 5000, // stopOnLastSlide: false, // disableOnInteraction: false, // }, // on: { // slideChangeTransitionStart: function() { // $('.bannerBar .item').eq(this.activeIndex).addClass("active").siblings().removeClass("active"); // }, // init: function(swiper){ // $('.bannerBar .item').eq(0).addClass("active").siblings().removeClass("active"); // } // } // }); var interleaveOffset = 0.5; var swiperOptions = { loop: false, speed: 1000, mousewheelControl: false, keyboardControl: false, autoplay: { delay: 5000, stopOnLastSlide: false, disableOnInteraction: false, }, on: { progress: function() { var swiper = this; for (var i = 0; i < swiper.slides.length; i++) { var slideProgress = swiper.slides[i].progress; var innerOffset = swiper.width * interleaveOffset; var innerTranslate = slideProgress * innerOffset; swiper.slides[i].querySelector(".pic").style.transform = "translate3d(" + innerTranslate + "px, 0, 0)"; } }, touchStart: function() { var swiper = this; for (var i = 0; i < swiper.slides.length; i++) { swiper.slides[i].style.transition = ""; } }, setTransition: function(speed) { var swiper = this; for (var i = 0; i < swiper.slides.length; i++) { swiper.slides[i].style.transition = speed + "ms"; swiper.slides[i].querySelector(".pic").style.transition = speed + "ms"; } }, slideChangeTransitionStart: function() { $('.bannerBar .item').eq(this.activeIndex).addClass("active").siblings().removeClass("active"); }, init: function(swiper){ $('.bannerBar .item').eq(0).addClass("active").siblings().removeClass("active"); } } }; var swiper3 = new Swiper(".bannerSwiper", swiperOptions); $(".bannerBar .item").hover(function(){ $(this).addClass("active").siblings().removeClass("active"); swiper3.slideTo(($(this).index()), 1000, false); }) } } } focusData = []; $.get("/apipro.html",{},function(data){ if(data.code == "200"){ focusData = data.data.product; $(".arimg1").attr("src",focusData[0].cover); $(".arimg2").attr("src",focusData[1].cover); $(".arimg3").attr("src",focusData[2].cover); $(".arCenter img").attr('src',focusData[0].cover); $(".arLeft .name .p p").html(focusData[0].subtitle); $(".arLeft .name .b p").html(focusData[0].title); $(".arLeft .des").html(focusData[0].content); for(var j = 0; j < focusData.length; j++){ $(".productSwiper .swiper-wrapper").append('
'+focusData[j].subtitle+'
'+focusData[j].title+'
'+focusData[j].content+'
') } for(var i = 0; i < focusData[0].features.length; i++){ $(".arRight").append('
'+focusData[0].features[i].title+'
'+focusData[0].features[i].content+'
') } var swiper = new Swiper(".productSwiper", { slidesPerView: 1, spaceBetween: 0, pagination: { el: '.productSwiper .swiper-pagination', }, }); $(".arprolist ul li").click(function(){ $(this).addClass("active").siblings().removeClass("active"); $(".arCenter").removeClass("is-inview"); var _index = $(this).index(); $(".arRight").html(""); setTimeout(function(){ $(".arCenter img").attr('src',focusData[_index].cover); $(".arCenter").addClass("is-inview"); $(".arLeft .name .p p").html(focusData[_index].subtitle); $(".arLeft .name .b p").html(focusData[_index].title); $(".arLeft .des").html(focusData[_index].content) for(var i = 0; i < focusData[_index].features.length; i++){ $(".arRight").append('
'+focusData[_index].features[i].title+'
'+focusData[_index].features[i].content+'
') } },10) }) } }) }, service:function(){ shutime.scrollToPos(75); $(".secondLab6 a,.Lab6 .lab").click(function(){ setTimeout(function(){ shutime.scrollToPos(75); },10) }) $(".culNav ul li").hover(function(){ $(this).addClass("active").siblings().removeClass("active"); $(".cul_list ul").eq($(this).index()).addClass("active").siblings().removeClass("active"); }) }, about: function() { shutime.scrollToPos(75); $(".secondLab4 a,.Lab4 .lab").click(function(){ setTimeout(function(){ shutime.scrollToPos(75); },10) }) var swiper = new Swiper(".hisSwiper", { slidesPerView: 5, grabCursor: true, autoplay:true, speed:600, spaceBetween: 10, navigation: { nextEl: ".hisSwiper .swiper-button-next", prevEl: ".hisSwiper .swiper-button-prev", }, breakpoints: { 320: { slidesPerView: 1, spaceBetween: 20, }, 768: { slidesPerView: 5, spaceBetween: 10, }, } }); $(".culNav ul li").hover(function(){ $(this).addClass("active").siblings().removeClass("active"); $(".cul_list ul").eq($(this).index()).addClass("active").siblings().removeClass("active"); }) shutime.map(); $(".vr_btn").click(function(){ // $(".vlightBox").addClass("active"); // $('.inner_player video').attr('src', $(this).attr("data-url")); // $('.inner_player video')[0].play(); }) $(".pro_close").click(function(){ $(".vlightBox").removeClass("active"); $('.inner_player video')[0].pause(); $('.inner_player video').attr('src',''); }) }, videoList: function() { var myVideo = document.getElementById("video"); $(".videoList ul li").click(function() { myVideo.setAttribute("src", $(this).attr("data-url")); $(".lightBox").addClass("active"); myVideo.play(); }) $(".videoCloseBtn").click(function() { $(".lightBox").removeClass("active"); myVideo.pause(); }) }, /** *閲囩敤swiper鐨刡anner鍒囨崲 * * 鏃犻渶浼犲弬 * 鍏煎绉诲姩绔 * */ swiperBanner: function() { var interleaveOffset = 0.5; var swiperOptions = { loop: true, speed: 1000, autoplay: true, grabCursor: true, watchSlidesProgress: true, mousewheelControl: true, keyboardControl: true, navigation: { nextEl: ".swiper-button-next.next", prevEl: ".swiper-button-prev.prev" }, pagination: { el: '.swiper-pagination.bannerDot', }, on: { progress: function() { var swiper = this; for (var i = 0; i < swiper.slides.length; i++) { var slideProgress = swiper.slides[i].progress; var innerOffset = swiper.width * interleaveOffset; var innerTranslate = slideProgress * innerOffset; swiper.slides[i].querySelector(".slide-inner").style.transform = "translate3d(" + innerTranslate + "px, 0, 0)"; } }, touchStart: function() { var swiper = this; for (var i = 0; i < swiper.slides.length; i++) { swiper.slides[i].style.transition = ""; } }, slideChange: function() { $('.jgs a').eq(this.activeIndex - 1).addClass("active").siblings().removeClass( "active"); }, setTransition: function(speed) { var swiper = this; for (var i = 0; i < swiper.slides.length; i++) { swiper.slides[i].style.transition = speed + "ms"; swiper.slides[i].querySelector(".slide-inner").style.transition = speed + "ms"; } } } }; var swiper = new Swiper(".swiper-container.swiperBanner", swiperOptions); }, /** *鍥炲埌椤堕儴 * * 鏃犻渶浼犲弬 * 鍏煎绉诲姩绔 * */ backTop: function() { $(window).scroll(function() { var sTop = $(window).scrollTop(); if (sTop > 100) { $(".backTop").addClass("active"); } else { $(".backTop").removeClass("active"); } }); $(".backTop").click(function() { $('body,html').animate({ scrollTop: 0 }, 500); }) }, /** *姘寸汗鍔ㄦ晥 * * 鏃犻渶浼犲弬 * 鍏煎绉诲姩绔 * */ wave: function() { var unit = 100, canvas, context, canvas2, context2, height, width, xAxis, yAxis, draw; function init() { canvas = document.getElementById("sineCanvas"); canvas.width = document.documentElement.clientWidth; canvas.height = 150; context = canvas.getContext("2d"); height = canvas.height; width = canvas.width; xAxis = Math.floor(height / 2); yAxis = 0; draw(); } function draw() { context.clearRect(0, 0, width, height); drawWave('rgba(255,255,255,.3)', 1, 3, 0); draw.seconds = draw.seconds + .009; draw.t = draw.seconds * Math.PI; setTimeout(draw, 35); }; draw.seconds = 0; draw.t = 0; function drawWave(color, alpha, zoom, delay) { context.fillStyle = color; context.globalAlpha = alpha; context.beginPath(); drawSine(draw.t / 0.5, zoom, delay); context.lineTo(width + 10, height); context.lineTo(0, height); context.closePath() context.fill(); context.lineWidth = 2; context.strokeStyle = "#ffffff"; context.stroke(); } function drawSine(t, zoom, delay) { var x = t; var y = Math.sin(x) / zoom; context.moveTo(yAxis, unit * y + xAxis); for (i = yAxis; i <= width + 10; i += 10) { x = t + (-yAxis + i) / unit / zoom; y = Math.sin(x - delay) / 3; context.lineTo(i, unit * y + xAxis); } } init(); }, map: function() { var map = new BMap.Map("map"); var point = new BMap.Point(104.002304,30.46821); map.centerAndZoom(point, 16); var top_left_control = new BMap.ScaleControl({ anchor: BMAP_ANCHOR_TOP_LEFT }) var top_left_navigation = new BMap.NavigationControl(); var pt = new BMap.Point(104.002304,30.46821); var myIcon = new BMap.Icon("/resources/assets/images/common/mapIcon.png", new BMap.Size(60, 60)); var marker2 = new BMap.Marker(pt, { icon: myIcon }); map.addOverlay(marker2); map.addControl(top_left_control); map.addControl(top_left_navigation); }, /** *鏂伴椈鍒楄〃鍒嗛〉 * * 鏃犻渶浼犲弬 * 鍏煎绉诲姩绔 * */ page: function() { var total = Math.ceil($("#page").attr("data-total") / $("#page").attr("data-size")); var curPage = $("#page").attr("data-page"); var pageSize = $("#page").attr("data-size"); var url = $("#page").attr("data-cat"); new Paging('page', { nowPage: Number(curPage), // 褰撳墠椤电爜 pageNum: total, // 鎬婚〉鐮 buttonNum: pageSize, //瑕佸睍绀虹殑椤电爜鏁伴噺 canJump: 0, // 鏄惁鑳借烦杞€?=涓嶆樉绀猴紙榛樿锛夛紝1=鏄剧ず showOne: 1, //鍙湁涓€椤垫椂锛屾槸鍚︽樉绀恒€?=涓嶆樉绀?1=鏄剧ず锛堥粯璁わ級 callback: function(num) { //鍥炶皟鍑芥暟 window.location.href = url + num + ".html" } }) }, /** *鏂伴椈鍒楄〃鍒嗛〉 * * @sucess 鎴愬姛|澶辫触 * 鍏煎绉诲姩绔 * */ toast: function(msg, sucess) { $(".toast").addClass("active").find("p").html(msg); if (!sucess) { $(".toast").addClass("icon-warning").find("b").html("鎻愮ず"); } else { $(".toast").addClass("icon-success").find("b").html("鎴愬姛"); } setTimeout(function() { $(".toast").removeClass("active") }, 3500) setTimeout(function() { $(".toast").removeClass("icon-warning") $(".toast").removeClass("icon-success"); }, 4000) }, /** *閲囩敤swiper鐨刡anner鍒囨崲 * * url:瑙嗛鎾斁璺緞 * 鍏煎绉诲姩绔 * */ videoList: function(url) { var myVideo = document.getElementById("video"); myVideo.setAttribute("src", url); $(".lightBox").addClass("active"); myVideo.play(); $(".videoCloseBtn").click(function() { $(".lightBox").removeClass("active"); myVideo.pause(); }) }, /** *瀹氫綅鍒版煇涓厓绱犱綅缃 * * @y:鍋忕Щ鐨勯珮搴 */ scrollToPos: function(_y) { var hash = window.location.hash; var pos = hash.substring(hash.indexOf('#') + 1); if (pos != '') getPos(pos); function getPos(ele) { $('html,body').animate({ scrollTop: $("." + ele + "").offset().top - _y }, 800); } }, /** *楠岃瘉鎵嬫満鍙风爜 * * @phone:鎵嬫満鍙风爜 * @return {姝g‘锛歵rue,閿欒锛歠alse} * */ regPhone: function(phone) { reg = /^(13|15|17|18|19|14)[0-9]{9}$/; return reg.test(phone); }, /** *楠岃瘉韬唤璇佸彿鐮 * * @phone:韬唤璇佸彿鐮 * @return {姝g‘锛歵rue,閿欒锛歠alse} * */ regID: function(IDcard) { reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; return reg.test(IDcard); }, /** *楠岃瘉閭鍙风爜 * * @Email:韬唤璇佸彿鐮 * @return {姝g‘锛歵rue,閿欒锛歠alse} * */ regEmail: function(Email) { reg = /^\w+\@+[0-9a-zA-Z]+\.(com|com.cn|edu|hk|cn|net)$/; return reg.test(Email); }, /** *楠岃瘉鏄惁鏄腑鏂 * * @name:鏂囧瓧 * @return {姝g‘锛歵rue,閿欒锛歠alse} * */ regZh: function(name) { reg = /^[\u4E00-\u9FA5A-Za-z]+$/; return reg.test(name); }, /** *楠岃瘉绾暟瀛 * * @number:鏁板瓧 * @return {姝g‘锛歵rue,閿欒锛歠alse} * */ regNumber: function(number) { reg = /^[0-9]*$/; return reg.test(number); }, /** *鑾峰彇鏁版嵁 * * @param {String} url 浼犲叆鐨勬暟鎹帴鍙 * @param {Object} para 浼犲叆鐨勫弬鏁 * @param {Object} callback 杩斿洖 */ getDataForApi: function(type, url, para, callback) { $.ajax({ type: type, data: para, url: window.location.protocol + '//' + window.location.host + url, dataType: 'json', success: function(data) { callback(data) }, error: function(e) { console.log(e, "鏁版嵁鍔犺浇閿欒") } }) }, } shutime.init();