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

'); $(".menu_btn").click(function() { $(this).toggleClass("active"); $(".nav").toggleClass("active"); }) $(".nav .mask").click(function() { $(".menu_btn,.nav").removeClass("active"); }) $(window).scroll(function() { var scrollTop = $(window).scrollTop(); if (scrollTop > 0) { $(".header").addClass("active") } else { $(".header").removeClass("active") } }); $(".nav ul li").hover(function() { $(".header_mask").addClass("active"); }, function() { $(".header_mask").removeClass("active"); }) $(".header").hover(function() { $(".header").addClass("show") }, function() { $(".header").removeClass("show") }) $(".sub_header ul li").hover(function() { $(".sub_header").addClass("active"); }, function() { $(".sub_header").removeClass("active"); $(".sub_header ul li").removeClass("active"); }) $(".search_box").click(function() { $(".search_result").addClass("active"); }) $(".s_close").click(function() { $(".search_result").removeClass("active"); }) $('.search_box .row input').bind('keypress', function(event) { if (event.keyCode == "13") { if ($('.search_result .row input').val() == "") return; window.open("/search.html#keywords=" + $('.search_result .row input').val()); } }); $(".search_result .row .s_btn").click(function() { if ($('.search_result .row input').val() == "") return; if($(this).hasClass("russian")){ window.open("/russian/search.html#keywords=" + $('.search_result .row input').val()); }else{ window.open("/search.html#keywords=" + $('.search_result .row input').val()); } }) $(".nav ul li").hover(function(){ $(this).addClass("active").siblings().removeClass("active"); },function(){ $(this).removeClass("active"); }) $(".hplay_btn").click(function(){ var myVideo = document.getElementById("homevideo"); myVideo.play(); $(this).hide(); }) }, common_scroll: function() { const pageContainer = document.querySelector("#main-content-wrap"); const scroller = new LocomotiveScroll({ el: pageContainer, smooth: true, tablet: { breakpoint: 0, smooth: true }, mobile: { breakpoint: 0, smooth: true } }); scroller.on("scroll", function(ins) { if (ins.scroll.y > 0) { $(".header").addClass("active"); } else { $(".header").removeClass("active"); } }); setTimeout(function() { scroller.update(); console.log('update scroller') }, 1); window.onload = function() { scroller.update(); } var _y = 100; var hash = window.location.hash; var pos = hash.substring(hash.indexOf('#') + 2); var posArr = []; if (pos != ''){ setTimeout(function(){ $(".pele").each(function(index,ele){ posArr.push($(this).offset().top) console.log($(this).offset().top) }) console.log(posArr) scroller.scrollTo(posArr[pos] - _y) },100) } $(".nav .dm_menu a").click(function(){ setTimeout(function(){ var hash = window.location.hash; var pos = hash.substring(hash.indexOf('#') + 2); if (pos != ''){ scroller.scrollTo(posArr[pos] - _y) } $(".nav ul li,.header_mask").removeClass("active"); },100) }) }, index: function() { const pageContainer = document.querySelector("#main-content-wrap"); gsap.registerPlugin(ScrollTrigger); const scroller = new LocomotiveScroll({ el: pageContainer, smooth: true, tablet: { breakpoint: 0 }, mobile: { smooth: true }, }); window.onload = function() { scroller.update(); } ScrollTrigger.scrollerProxy(pageContainer, { scrollTop(value) { return arguments.length ? scroller.scrollTo(value, 0, 0) : scroller.scroll.instance.scroll.y; }, getBoundingClientRect() { return { left: 0, top: 0, width: window.innerWidth, height: window.innerHeight }; }, pinType: pageContainer.style.transform ? "transform" : "fixed" }); const horizontalSections = gsap.utils.toArray('.scroll-horizontal') horizontalSections.forEach(function(sec, i) { var thisPinWrap = sec.querySelector('.pin-wrap'); var thisAnimWrap = thisPinWrap.querySelector('.animation-wrap'); var dif = 0; if (sec.offsetWidth < window.innerWidth) { dif = sec.offsetWidth; } var getToValue = () => -(thisAnimWrap.scrollWidth - window.innerWidth + dif); let scrollTween = gsap.fromTo(thisAnimWrap, { x: () => thisAnimWrap.classList.contains('to-right') ? 0 : getToValue() }, { x: () => thisAnimWrap.classList.contains('to-right') ? getToValue() : 0, ease: "none", scrollTrigger: { scroller: pageContainer, trigger: sec, start: "top top", end: () => "+=" + (thisAnimWrap.scrollWidth - window.innerWidth), pin: thisPinWrap, invalidateOnRefresh: true, scrub: 0.1, } }); const boxes = gsap.utils.toArray('.item', sec); boxes.forEach((box, i) => { ScrollTrigger.create({ trigger: box, markers: false, scroller: thisPinWrap, containerAnimation: scrollTween, onEnter: () => { $(".serNav a").eq(i).addClass("active").siblings() .removeClass("active"); }, onEnterBack: () => { $(".serNav a").eq(i).addClass("active").siblings() .removeClass("active"); }, onToggle: self => { if (self.isActive) { // addClass(box, 'is-inview'); } else { // removeClass(box, 'is-inview'); } }, }); }); }); var _w = $(window).width(); scroller.on("scroll", function(ins) { if (ins.scroll.y > 0) { $(".header").addClass("active"); } else { $(".header").removeClass("active"); } if (ins.scroll.y > $(".scroll-horizontal .item").eq(0).offset().top + _w * 0.3) { $(".scroll-horizontal .item").eq(0).find(".sbg").addClass("active"); } if (ins.scroll.y > $(".scroll-horizontal .item").eq(1).offset().top + _w * 1.3) { $(".scroll-horizontal .item").eq(1).find(".sbg").addClass("active"); } if (ins.scroll.y > $(".scroll-horizontal .item").eq(2).offset().top + _w * 2.3) { $(".scroll-horizontal .item").eq(2).find(".sbg").addClass("active"); } if (ins.scroll.y > $(".scroll-horizontal .item").eq(3).offset().top + _w * 3.3) { $(".scroll-horizontal .item").eq(3).find(".sbg").addClass("active"); } ScrollTrigger.update(); }); window.onload = function() { scroller.update(); } ScrollTrigger.addEventListener("refresh", () => scroller.update()); ScrollTrigger.refresh(); var go = $("#scroll-direction").offset().top; var _h = $(window).width(); $('.serNav a').click(function() { var index = $(this).index(); scroller.scrollTo(go + _h * index) }) var _video = document.getElementById("video"); $(".play_btn").click(function() { $(".lightBox").addClass("active"); $("#video").attr("src", $(this).attr("data-src")); }) $(".video_close").click(function() { $("#video").attr("src", ""); $(".lightBox").removeClass("active"); }) new Swiper(".newsSwiper", { pagination: { el: ".newsSwiper .swiper-pagination", }, }); $(".box_nav ul li").hover(function() { $(this).addClass("active").siblings().removeClass("active"); }) new Swiper(".bannerSwiper", { spaceBetween: 0, speed: 1600, parallax: true, autoplay: { delay: 5000, stopOnLastSlide: false, disableOnInteraction: true, }, navigation: { nextEl: ".bannerSwiper .swiper-button-next", prevEl: ".bannerSwiper .swiper-button-prev", }, pagination: { clickable: true, el: ".bannerSwiper .swiper-pagination", }, }); var m_no = 0; var m_total = $(".noticeList ul>li").length; var htTime = setInterval(moveRight,5000); $(".notice_close").click(function(){ $(".notice_focus").addClass("active"); }) // $(".noticeList").hover(function(){ // clearInterval(htTime); // },function(){ // htTime = setInterval(moveRight,5000); // }) // $(".next").click(function(){ // moveRight(); // }) // $(".prev").click(function(){ // moveLeft(); // }) setInterval(function(){ moveRight(); },5000) function moveRight(){ m_no=++m_no>m_total-1?0:m_no; $(".noticeList ul>li:first").stop().animate({marginTop:"-20px"},'slow',function(){$(this).detach().appendTo($(".noticeList ul")).css("margin-top","0px")}); } // function moveLeft(){ // m_no=--m_no<0?m_total-1:m_no; // $(".noticeList ul li:last").stop().css("margin-top","-20px").detach().prependTo($(".noticeList ul")).animate({marginTop:"0px"}) // } }, title: function() { $(".subTitle").each(function(i) { var splitone = new SplitText($(this).find("b"), { type: 'chars, words', charsClass: 'chars', linesClass: 'lines' }); }); }, network: function() { }, /** *公告信息切换 * * 无需传参 */ notice: function() { }, about: function() { var mySiwper = new Swiper('.swiper-container.dotSwiper', { slidesPerView: 5, spaceBetween: 0, speed: 700, autoplay: { delay: 5000, stopOnLastSlide: false, disableOnInteraction: true, }, centeredSlides: true, navigation: { nextEl: '.swiper-button-next.dot-next', prevEl: '.swiper-button-prev.dot-prev', }, on: { slideChange: function() { this.activeIndex % 2 != 0 ? $(".swiper-container.dotSwiper").addClass("even") : $( ".swiper-container.dotSwiper").removeClass("even"); $(".show_achie .year").html($(".dotSwiper .swiper-slide").eq(this.activeIndex) .attr("data-year")) $(".show_achie .des").html($(".dotSwiper .swiper-slide").eq(this.activeIndex) .find(".content").html()); }, }, breakpoints: { 320: { slidesPerView: 1, spaceBetween: 0, }, 768: { slidesPerView: 5, spaceBetween: 0, }, } }); $(".show_achie .year").html($(".swiper-container.dotSwiper .swiper-slide").eq(0).attr("data-year")) $(".show_achie .des").html($(".swiper-container.dotSwiper .swiper-slide").eq(0).find(".content") .html()); $(".swiper-container.dotSwiper .swiper-slide").click(function() { mySiwper.slideTo($(this).index()); $(this).addClass("active").siblings().removeClass("active"); $(".show_achie .year").html($(this).attr("data-year")) $(".show_achie .des").html($(this).find(".content").html()); }) $(".swiper-container.dotSwiper .swiper-slide").eq(0).addClass("active"); // honor_list var html = ""; var total = 0; var page = 1; loadPatent(page); function loadPatent(page) { $.get("/apipatent.html", { page: page }, function(data) { if (data.code == 200) { total = data.data.totalPage; html = template('zy', data.data); $('.honor_list ul').html(html); } }) } $(".honor_btn .btn.honor_prev").click(function() { console.log(total) page--; if (page < 1) { page = 1; return; } else { loadPatent(page) } }) $(".honor_btn .btn.honor_next").click(function() { console.log(total) page++; if (page > total) { page = total; return; } else { loadPatent(page) } }) new Swiper(".ser_list", { slidesPerView: 3, spaceBetween: 30, pagination: { el: ".ser_list .swiper-pagination", clickable: true, }, breakpoints: { 320: { slidesPerView: 1.5, spaceBetween: 20 }, 768: { slidesPerView: 3, spaceBetween: 30, }, } }); new Swiper(".honorSwiper", { slidesPerView: 2, spaceBetween: 10, pagination: { el: ".honorSwiper .swiper-pagination", type: "progressbar", }, }); new Swiper(".his_swiper", { slidesPerView: 3.2, speed: 500, spaceBetween: 100, autoplay: { delay: 5000, stopOnLastSlide: false, disableOnInteraction: true, }, pagination: { el: ".his_swiper .swiper-pagination", type: "progressbar", }, breakpoints: { 320: { slidesPerView: 1.1, spaceBetween: 20 }, 768: { slidesPerView: 3.2, spaceBetween: 100, }, } }); new Swiper(".hlSwiper", { direction: "vertical", slidesPerView: 3, centeredSlides: true, spaceBetween: 0, noSwiping: true, navigation: { nextEl: ".h_btn .next", prevEl: ".h_btn .prev", }, breakpoints: { 320: { direction: "horizontal", slidesPerView: 1.5, spaceBetween: 20, noSwiping: false, }, 768: { direction: "vertical", slidesPerView: 3, spaceBetween: 0, noSwiping: true, }, } }); new Swiper(".hrSwiper", { direction: "vertical", slidesPerView: 3, centeredSlides: true, spaceBetween: 30, noSwiping: true, navigation: { nextEl: ".h_btn .next", prevEl: ".h_btn .prev", }, }); }, invitation: function() { var id; $('._cover .iconfont').click(function() { $('._cover').hide(); }) $('.lists .item').click(function() { $('._cover').show(); id = $(this).attr('data-id'); console.log($(this).attr('data-id')); }); $('._cover .btn').click(function() { var val = $('input[name=captcha]').val(); if (val.replace(/\s/g, '').length === 0) { shutime.toast('请输入邀请码', false); return false; } console.log(document.cookie); $.ajax({ url: '/apiinv.html', type: "GET", data: { id: val }, success: function(res) { if (res.code == 200) { document.cookie = 'code=' + val; document.cookie = 'id=' + id; console.log(document.cookie); location.href = '/invitationinfo.html'; } else { shutime.toast(res.message, false); } } }) }) }, invitation_en: function() { var id; $('._cover .iconfont').click(function() { $('._cover').hide(); }) $('.lists .item').click(function() { $('._cover').show(); id = $(this).attr('data-id'); console.log($(this).attr('data-id')); }); $('._cover .btn').click(function() { var val = $('input[name=captcha]').val(); if (val.replace(/\s/g, '').length === 0) { shutime.toast('Enter invitation code', false); return false; } console.log(document.cookie); $.ajax({ url: '/en/apiinv.html', type: "GET", data: { id: val }, success: function(res) { if (res.code == 200) { document.cookie = 'code=' + val; document.cookie = 'id=' + id; console.log(document.cookie); location.href = '/en/invitationinfo.html'; } else { shutime.toast(res.message, false); } } }) }) }, invitation_els: function() { var id; $('._cover .iconfont').click(function() { $('._cover').hide(); }) $('.lists .item').click(function() { $('._cover').show(); id = $(this).attr('data-id'); console.log($(this).attr('data-id')); }); $('._cover .btn').click(function() { var val = $('input[name=captcha]').val(); if (val.replace(/\s/g, '').length === 0) { shutime.toast('Введите код приглашения.', false); return false; } $.ajax({ url: '/russian/apiinv.html', type: "GET", data: { id: val }, success: function(res) { if (res.code == 200) { document.cookie = 'code=' + val; document.cookie = 'id=' + id; console.log(document.cookie); location.href = '/russian/invitationinfo.html'; } else { shutime.toast("Неверный код приглашения ", false); } } }) }) }, app: function() { var type = ["合资建设","运营管理","设备购置"]; var index = 0; $(".selec_cooper ul li").click(function(){ $(this).addClass("active").siblings().removeClass("active"); index = $(this).index(); }) $(".cooper_btn").click(function(){ if ($(".user_company").val() == "") { $(".cooper_btn").removeClass("active"); shutime.toast('请填写您的单位名称', false); return; } if ($(".user_job").val() == "") { $(".cooper_btn").removeClass("active"); shutime.toast('请填写您的职务', false); return; } if ($("user_name").val() == "") { $(".cooper_btn").removeClass("active"); shutime.toast('请填写联系人', false); return; } if ($(".user_tel").val() == "") { $(".cooper_btn").removeClass("active"); shutime.toast('请填写手机号码', false); return; } else if (!shutime.regPhone($(".user_tel").val())) { $(".cooper_btn").removeClass("active"); shutime.toast('号码输入错误,请重新输入', false); return; } $.post("/apiform.html", { field_1:type[index], company: $(".user_company").val(), field_2: $(".user_job").val(), name:$(".user_name").val(), phone:$(".user_tel").val(), "_csrf-frontend": $("#csrf").val() }, function(data) { if (data.code == "200") { shutime.toast('提交成功,我们会尽快联系您', true); $(".cooper_btn").addClass("active"); } else { shutime.toast(data.message, false); $(".cooper_btn").removeClass("active"); } }) }) }, app_els: function() { var type = ["合资建设","运营管理","设备购置"]; var index = 0; $(".selec_cooper ul li").click(function(){ $(this).addClass("active").siblings().removeClass("active"); index = $(this).index(); }) $(".cooper_btn").click(function(){ if ($(".user_company").val() == "") { $(".cooper_btn").removeClass("active"); shutime.toast('введите Название организации', false); return; } if ($(".user_job").val() == "") { $(".cooper_btn").removeClass("active"); shutime.toast('введите должность', false); return; } if ($("user_name").val() == "") { $(".cooper_btn").removeClass("active"); shutime.toast('введите должность', false); return; } if ($(".user_tel").val() == "") { $(".cooper_btn").removeClass("active"); shutime.toast('введите контактное лицо', false); return; } $.post("/apiform.html", { field_1:type[index], company: $(".user_company").val(), field_2: $(".user_job").val(), name:$(".user_name").val(), phone:$(".user_tel").val(), "_csrf-frontend": $("#csrf").val() }, function(data) { if (data.code == "200") { shutime.toast('Успешное представление', true); $(".cooper_btn").addClass("active"); } else { shutime.toast(data.message, false); $(".cooper_btn").removeClass("active"); } }) }) }, product: function() { var rellax = new Rellax('.rellax'); $(".pbox a").click(function() { $(this).addClass("active").siblings().removeClass("active"); setTimeout(function() { shutime.scrollToPos(50); }, 10) }) shutime.scrollToPos(50); }, case:function(){ const pageContainer = document.querySelector("#main-content-wrap"); const scroller = new LocomotiveScroll({ el: pageContainer, smooth: true, tablet: { breakpoint: 0 } }); scroller.on("scroll", function(ins) { if (ins.scroll.y > 0) { $(".header").addClass("active"); } else { $(".header").removeClass("active"); } }); setTimeout(function() { scroller.update(); console.log('update scroller') }, 1); window.onload = function() { scroller.update(); } var _y = 100; var hash = window.location.hash; var pos = hash.substring(hash.indexOf('#') + 2); var posArr = []; if (pos != ''){ setTimeout(function(){ $(".pele").each(function(index,ele){ posArr.push($(this).offset().top) console.log($(this).offset().top) }) console.log(posArr) scroller.scrollTo(posArr[pos] - _y) },100) } var caseP = new Swiper(".caseSwiper", { effect: "coverflow", grabCursor: true, speed:500, loop:true, centeredSlides: true, slidesPerView: "auto", coverflowEffect: { rotate: 50, stretch: 0, depth: 100, modifier: 1, slideShadows: true, }, pagination: { el: ".caseSwiper .swiper-pagination", }, }); loadCase($(".select ul li").eq(0).attr('data-id')) function loadCase(id){ $.get("/apicase.html", { id:id, }, function(data) { if (data.code == "200") { var html = template('case', data); $(".caseSwiper .swiper-wrapper").html(html); caseP.slideTo(0); caseP.update(); caseP.pagination.update(); caseP.autoplay.start(); setTimeout(function(){ scroller.update(); },100) } }) } $(".select ul li").click(function() { $(".result").html($(this).text()) $(".select").removeClass("active"); loadCase($(this).attr("data-id")); }) $(".select").hover(function() { $(".select").addClass("active"); }, function() { $(".select").removeClass("active"); }) }, 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的fade切换 * * 无需传参 * 兼容移动端 * */ swiperFade: function() { new Swiper('.swiper-container.swiperNomal', { autoplay: { delay: 5000, disableOnInteraction: false, }, spaceBetween: 30, loop: true, effect: 'fade', speed: 500, pagination: { el: '.swiper-pagination.dot', clickable: true }, navigation: { nextEl: '.btnBox .next', prevEl: '.btnBox .prev', }, }); }, /** *采用swiper的banner切换 * * 无需传参 * 兼容移动端 * */ 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() { $(".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(103.496958, 29.599326); 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(103.496958, 29.599326); var myIcon = new BMap.Icon("./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, // 是否能跳转。0=不显示(默认),1=显示 showOne: 1, //只有一页时,是否显示。0=不显示,1=显示(默认) callback: function(num) { //回调函数 window.location.href = url + num + ".html" } }) }, /** *新闻列表分页 * * @sucess 成功|失败 * 兼容移动端 * */ toast: function(msg,sucess) { $(".toast").addClass("active").find("span").html(msg); if (!sucess) { $(".toast").addClass("warning"); } else { $(".toast").addClass("success"); } setTimeout(function() { $(".toast").removeClass("active") $(".toast").removeClass("warning") $(".toast").removeClass("success"); }, 3500) }, /** *采用swiper的banner切换 * * 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); console.log(pos) console.log(pos.substring(1)) function getPos(ele) { $('html,body').animate({ scrollTop: $("." + ele + "").offset().top - _y }, 600); // $("html,body").animate({scrollTop: $("." + ele + "").offset().top - _y}, 800, "easeOutQuart", function() {}) } }, /** *验证手机号码 * * @phone:手机号码 * @return {正确:true,错误:false} * */ regPhone: function(phone) { reg = /^(13|15|17|18|19|14)[0-9]{9}$/; return reg.test(phone); }, /** *验证身份证号码 * * @phone:身份证号码 * @return {正确:true,错误:false} * */ regID: function(IDcard) { reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; return reg.test(IDcard); }, /** *验证邮箱号码 * * @Email:身份证号码 * @return {正确:true,错误:false} * */ regEmail: function(Email) { reg = /^\w+\@+[0-9a-zA-Z]+\.(com|com.cn|edu|hk|cn|net)$/; return reg.test(Email); }, /** *验证是否是中文 * * @name:文字 * @return {正确:true,错误:false} * */ regZh: function(name) { reg = /^[\u4E00-\u9FA5A-Za-z]+$/; return reg.test(name); }, /** *验证纯数字 * * @number:数字 * @return {正确:true,错误:false} * */ 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();