$(function(){ // $(".processing").removeClass(".tit-18"); // $(".processing").addClass(".tit-16"); // $(".processing").html("内容整理中..."); }) function scrollAnimation(ele) { $(ele).each(function() { var _this = $(this); if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) { // _this.removeClass('animate'); } else if ($(window).scrollTop() >= _this.offset().top - $(window).height() * 0.92) { _this.addClass('animate'); } }); $(window).scroll(function(){ $(ele).each(function() { var _this = $(this); if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) { // _this.removeClass('animate'); } else if ($(window).scrollTop() >= _this.offset().top - $(window).height() * 0.92) { _this.addClass('animate'); } }); }); } function scrollAni2(selector,y,callback) { y=y||$(window).height()*0.2; selector=selector||$('.js-m'); selector.each(function() { var _this = $(this); var ot=_this.offset().top; var st=$(window).scrollTop(); var wh=$(window).height(); var divH=_this.outerHeight(); if(st>ot){ if(st-ot-divH<=y){ if (typeof (callback) == 'function') { callback(); } } }else{ if(ot-wh-st<=y){ if (typeof (callback) == 'function') { callback(); } } } }); window.addEventListener('scroll', debounce(function(){ selector.each(function() { var _this = $(this); var ot=_this.offset().top; var st=$(window).scrollTop(); var wh=$(window).height(); var divH=_this.outerHeight(); if(st>ot){ if(st-ot-divH<=y){ if (typeof (callback) == 'function') { callback(); } } }else{ if(ot-wh-st<=y){ if (typeof (callback) == 'function') { callback(); } } } }); },100,false)); } function visual_button_scroll_down(){ $('.scroll_down').on('click',function(){ var target = $(this).attr('href'); var target_top = $(target).offset().top - 75; $('html,body').animate({ scrollTop : target_top },600, 'easeInOutQuad'); return false; }); } visual_button_scroll_down(); $(function(){ if ($(".warp-header").length<1) { if ($(window).width()>1366) { if ($(window).scrollTop() > 100) { $("header").addClass("header-up"); }else{ $("header").removeClass("header-up"); } }else{ if ($(window).scrollTop() > 0) { $("header").addClass("header-up"); }else{ $("header").removeClass("header-up"); } } $(window).scroll("resize",function(){ // console.log(11) if ($(window).width()>1366) { if ($(window).scrollTop() > 100) { $("header").addClass("header-up"); }else{ $("header").removeClass("header-up"); } }else{ if ($(window).scrollTop() > 0) { $("header").addClass("header-up"); }else{ $("header").removeClass("header-up"); } } if ($(".warp-gov .gov-nav").length<1) { if ($(window).scrollTop() > $(".nbanner").height()) { $(".subnav").addClass("active"); }else{ $(".subnav").removeClass("active"); } }; }); }; }) $(function(){ if(!placeholderSupport()){ // 判断浏览器是否支持 placeholder $('[placeholder]').focus(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); input.removeClass('placeholder'); } }).blur(function() { var input = $(this); if (input.val() == '' || input.val() == input.attr('placeholder')) { input.addClass('placeholder'); input.val(input.attr('placeholder')); } }).blur(); }; }) function placeholderSupport() { return 'placeholder' in document.createElement('input'); } //设置cookie function setCookie(name, value, seconds) { seconds = seconds || 0; //seconds有值就直接赋值,没有为0,这个根php不一样。 var expires = ""; if (seconds != 0) { //设置cookie生存时间 var date = new Date(); date.setTime(date.getTime() + (seconds * 1000)); expires = "; expires=" + date.toGMTString(); } document.cookie = name + "=" + escape(value) + expires + "; path=/"; //转码并赋值 } //取得cookie function getCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); //把cookie分割成组 for (var i = 0; i < ca.length; i++) { var c = ca[i]; //取得字符串 while (c.charAt(0) == ' ') { //判断一下字符串有没有前导空格 c = c.substring(1, c.length); //有的话,从第二位开始取 } if (c.indexOf(nameEQ) == 0) { //如果含有我们要的name return unescape(c.substring(nameEQ.length, c.length)); //解码并截取我们要值 } } return false; } //清除cookie function clearCookie(name) { setCookie(name, "", -1); } /*文字设置*/ function aniText(items,delay){ delay=delay||0.02; var tween=TweenMax.staggerTo($('.col .split',items), 1, {y:"0%",autoAlpha: 1,ease:Back.easeOut }, delay); var colPtime=1.5; TweenMax.to($('.col-p',items),colPtime,{ y: '0%', autoAlpha: 1, ease:Expo.easeOut, delay: (tween.length+2)*delay }); var delayBtn=0; if($('.col-p',items).length>0){ delayBtn=0.5; } TweenMax.to($('.col-btn',items),0.8,{ y: '0%', autoAlpha: 1, ease:Expo.easeOut, delay: (tween.length+2)*delay+delayBtn }); } function clearTextAni(items){ TweenMax.set($('.col .split',items),{ y: '50%', autoAlpha: 0 }); TweenMax.set($('.col-p',items),{ y: '50%', autoAlpha: 0 }); TweenMax.set($('.col-btn',items),{ y: '50%', autoAlpha: 0 }); } function aniline(items,delay){ delay=delay||0.05; TweenMax.staggerTo($('.col',items), 1, {y:"0%",autoAlpha: 1,ease:Back.easeOut }, delay); TweenMax.to($('.col-btn',items),0.8,{ y: '0%', autoAlpha: 1, ease:Expo.easeOut, delay: 1 }); } function clearlineAni(items){ TweenMax.staggerTo($('.col',items),0,{ y: '50%', autoAlpha: 0 },0); TweenMax.set($('.col-btn',items),{ y: '50%', autoAlpha: 0 }); } // 浏览器兼容 function getBroswerAndVersion(){ var os = navigator.platform; var userAgent = navigator.userAgent; var info = ""; var tempArray = ""; //判断浏览器版本 var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器 var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器 var isEdge = userAgent.toLowerCase().indexOf("edge") > -1 && !isIE; //判断是否IE的Edge浏览器 var isIE11 = (userAgent.toLowerCase().indexOf("trident") > -1 && userAgent.indexOf("rv") > -1); if (/[Ff]irefox(\/\d+\.\d+)/.test(userAgent) || /[Cc]hrome\/\d+/.test(userAgent) || /[Vv]ersion\/\d+\.\d+\.\d+(\.\d)* *[Ss]afari/.test(userAgent) || /[Oo]pera.+[Vv]ersion\/\d+\.\d+/.test(userAgent)) { // tempArray = /([Ff]irefox)\/(\d+\.\d+)/.exec(userAgent); // info += tempArray[1] + tempArray[2]; // alert(info); var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%","height":"auto"}); $(".section2 .svg2").css({"width":"100%","height":"auto"}); $(".section2 .svg3").css({"width":"100%","height":"auto"}); }else{ $(".section2 .svg1").css({"width":"auto","height":"100%"}); $(".section2 .svg2").css({"width":"auto","height":"100%"}); $(".section2 .svg3").css({"width":"auto","height":"100%"}); } window.onresize = function(e){ var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%","height":"auto"}); $(".section2 .svg2").css({"width":"100%","height":"auto"}); $(".section2 .svg3").css({"width":"100%","height":"auto"}); }else{ $(".section2 .svg1").css({"width":"auto","height":"100%"}); $(".section2 .svg2").css({"width":"auto","height":"100%"}); $(".section2 .svg3").css({"width":"auto","height":"100%"}); } } } else if (isIE) { var version = ""; var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); reIE.test(userAgent); var fIEVersion = parseFloat(RegExp["$1"]); if (fIEVersion == 7){ version = "IE7"; // console.log(version); } else if (fIEVersion == 8) { version = "IE8"; } else if (fIEVersion == 9) { version = "IE9"; // console.log(version); } else if (fIEVersion == 10) { version = "IE10"; // alert(version); // $(".section2 .imgbox .svg4").hide(); var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%"}); $(".section2 .svg2").css({"width":"100%"}); $(".section2 .svg3").css({"width":"100%"}); }else{ $(".section2 .svg1").css({"height":"100%"}); $(".section2 .svg2").css({"height":"100%"}); $(".section2 .svg3").css({"height":"100%"}); } window.onresize = function(e){ var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%"}); $(".section2 .svg2").css({"width":"100%"}); $(".section2 .svg3").css({"width":"100%"}); }else{ $(".section2 .svg1").css({"height":"100%"}); $(".section2 .svg2").css({"height":"100%"}); $(".section2 .svg3").css({"height":"100%"}); } } // console.log(info) }else{ version = "0"; // alert(version); } info += version; }else if (isEdge) { info += "Edge"; // alert(info); var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%"}); $(".section2 .svg2").css({"width":"100%"}); $(".section2 .svg3").css({"width":"100%"}); }else{ $(".section2 .svg1").css({"height":"100%"}); $(".section2 .svg2").css({"height":"100%"}); $(".section2 .svg3").css({"height":"100%"}); } window.onresize = function(e){ var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%"}); $(".section2 .svg2").css({"width":"100%"}); $(".section2 .svg3").css({"width":"100%"}); }else{ $(".section2 .svg1").css({"height":"100%"}); $(".section2 .svg2").css({"height":"100%"}); $(".section2 .svg3").css({"height":"100%"}); } } }else if (isIE11) { info += "IE11"; // console.log(info) // $(".section2 .imgbox .svg4").hide(); var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%"}); $(".section2 .svg2").css({"width":"100%"}); $(".section2 .svg3").css({"width":"100%"}); }else{ $(".section2 .svg1").css({"height":"100%"}); $(".section2 .svg2").css({"height":"100%"}); $(".section2 .svg3").css({"height":"100%"}); } window.onresize = function(e){ var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%"}); $(".section2 .svg2").css({"width":"100%"}); $(".section2 .svg3").css({"width":"100%"}); }else{ $(".section2 .svg1").css({"height":"100%"}); $(".section2 .svg2").css({"height":"100%"}); $(".section2 .svg3").css({"height":"100%"}); } } }else { info += "unknown"; var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%","height":"auto"}); $(".section2 .svg2").css({"width":"100%","height":"auto"}); $(".section2 .svg3").css({"width":"100%","height":"auto"}); }else{ $(".section2 .svg1").css({"width":"auto","height":"100%"}); $(".section2 .svg2").css({"width":"auto","height":"100%"}); $(".section2 .svg3").css({"width":"auto","height":"100%"}); } window.onresize = function(e){ var w = $(window).width(); var h = $(window).height(); if ((h/w) < 0.5625) { $(".section2 .svg1").css({"width":"100%","height":"auto"}); $(".section2 .svg2").css({"width":"100%","height":"auto"}); $(".section2 .svg3").css({"width":"100%","height":"auto"}); }else{ $(".section2 .svg1").css({"width":"auto","height":"100%"}); $(".section2 .svg2").css({"width":"auto","height":"100%"}); $(".section2 .svg3").css({"width":"auto","height":"100%"}); } } } return info; } getBroswerAndVersion(); function myBrowser(){ var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 var isOpera = userAgent.indexOf("Opera") > -1; if (isOpera) { return "Opera" }; //判断是否Opera浏览器 if (userAgent.indexOf("Firefox") > -1) { return "FF"; } //判断是否Firefox浏览器 if (userAgent.indexOf("Chrome") > -1){ return "Chrome"; } if (userAgent.indexOf("Safari") > -1) { return "Safari"; } //判断是否Safari浏览器 if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) { return "IE"; }; //判断是否IE浏览器 } //以下是调用上面的函数 function myBrowser_Safari(){ var mb = myBrowser(); if ("IE" == mb) { //alert("我是 IE"); } if ("FF" == mb) { //alert("我是 Firefox"); } if ("Chrome" == mb) { //alert("我是 Chrome"); } if ("Opera" == mb) { //alert("我是 Opera"); } if ("Safari" == mb) { // alert("我是 Safari"); // alert($(".imgwidth").length); $(".js-m.imgwidth").each(function(){ $(this).addClass("imgwidth2 translate-left1"); }) $(".warpvideo").css({"overflow":"visible"}); $(".warpvideo .top-controls").css({"top":"-50px"}); } } /*回到顶部*/ $(document).on('click','.back-top',function(){ $('html,body').animate({scrollTop:0},{ duration: 600 }); }); $(document).on('click','.downbtn',function(){ $('html,body').animate({scrollTop:$(".nbanner").height()},{ duration: 600 }); }); $(document).on('click','.downbtn-bottom',function(){ $('html,body').animate({scrollTop:$(document).height()},{ duration: 1200 }); }); function getUrlParam(name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null; } //文字框 $(".footer-top .input1").focus(function(){ $(this).parent(".bot-from").addClass("active"); }); $(".footer-top .input1").blur(function(){ $(this).parent(".bot-from").removeClass("active"); }); // $(".inputanimate").focus(function(){ // $(this).parents(".li").find(".sptip").addClass("active"); // }); // $(".inputanimate").blur(function(){ // $(this).parents(".li").find(".sptip").removeClass("active"); // }); $(".selectbox .spitem .option").on("click",function(){ var txt = $(this).attr("data-name"); // console.log(txt); $(this).parents(".selectbox").find(".spname").attr("data-name",txt) $(this).parents(".selectbox").find(".spname span").html(txt); }) var startx, starty; //手指接触屏幕 document.addEventListener("touchstart", function(e) { // e.preventDefault(); startx = e.touches[0].pageX; starty = e.touches[0].pageY; }, false); //手指离开屏幕 document.addEventListener("touchend", function(e) { // e.preventDefault(); var endx, endy; endx = e.changedTouches[0].pageX; endy = e.changedTouches[0].pageY; var direction = getDirection(startx, starty, endx, endy); // alert(direction) if(direction==4&&$('.bocweb-header-m').hasClass('ishow')){ $('.bocweb-header-m').removeClass('ishow'); $('.bocweb-nav li .hide',$('.bocweb-header-m')).removeClass('ishow'); } }, false); /*获得角度*/ function getAngle(angx, angy) { return Math.atan2(angy, angx) * 180 / Math.PI; }; /*根据起点终点返回方向 1向上 2向下 3向左 4向右 0未滑动*/ function getDirection(startx, starty, endx, endy) { var angx = endx - startx; var angy = endy - starty; var result = 0; //如果滑动距离太短 if (Math.abs(angx) < 2 && Math.abs(angy) < 2) { return result; } var angle = getAngle(angx, angy); if (angle >= -45 && angle <= 45) { result = 4; } return result; } //flex两端对齐最后一排对齐 function calcChild(parentul,childli,item){ var parentWidth = parentul.width(); var childWidth = childli.width(); var sumChild = childli.length; // console.log(parentWidth,childWidth,sumChild); //每行最多个数 var maxNum = Math.floor(parentWidth/childWidth); // console.log(maxNum); //最后一行缺多少个 if(sumChild > 0){ var needAddNum = (sumChild%maxNum); // console.log(sumChild); // console.log(needAddNum); if (needAddNum>0) { for(var i = 0;i<=needAddNum-1;i++){ parentul.append(""); } }else{ for(var i = 0;i