// javascript document $(document).ready(function() { new wow().init(); navl(); autoheight(); removenewsstyle('.news-content'); $('.num').each(function(){ $(this).countup(); }) layui.use('layer', function(){ var layer = layui.layer; //相册弹层 layer.photos({ photos: '#layer-photos' ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) ,shade: .85 }); var vid = 0; $('.video-btn').each(function(index,el){ $(this).attr('data-num',index); }) $('.video-btn').click(function(e){ vid = $(this).attr('data-num'); var flag = false; var type = ["mp4"]; var tit = $(this).attr('data-title')?$(this).attr('data-title'):''; var index = $(this).attr('data-video').lastindexof("."); var ext = $(this).attr('data-video').substr(index+1); //循环比较 for(var i=0;i当前浏览器不支持 video直接播放', }); var video = document.getelementbyid("video"); video.play(); }else{ layer.open({ type: 2, title: false, shade: 0.7, anim: 5, isoutanim:false, skin:'video-show', content: $(this).attr('data-video'), }); } //创建按钮名称 $('.video-show .layui-layer-content').append('
'+tit+'
'); vidbtn('.video-prev','.video-next',vid,0,$('.video-btn').length); }); //视频切换 $('body').on('click','.video-switch-btn',function(){ if($(this).hasclass('video-prev')){ vid--; }else if($(this).hasclass('video-next')){ vid++; } $(this).parent().find('video').attr('src',$("[data-num='"+vid+"']").attr('data-video')); $(this).parent().find('.video-tit span').html($("[data-num='"+vid+"']").attr('data-title')?$("[data-num='"+vid+"']").attr('data-title'):''); var video = document.getelementbyid("video"); video.play(); vidbtn('.video-prev','.video-next',vid,0,$('.video-btn').length); }) // 登录 & 注册 弹窗 var layeris = false; var tabsnum = 0; var layerlogin; $('.job-box-tr').on('click','.login-btn,.logon-btn',function(){ if(!layeris){ layeris = true; layerlogin = layer.open({ type: 1, anim: 5, isoutanim:false, shade: 0.5, title: false, closebtn :0, skin: 'login-lay', content: $('.login-box'), }); } if($(this).hasclass('logon-btn')){ tabsnum = 0; }else if($(this).hasclass('login-btn')){ tabsnum = 1; } login.tabsswitch(tabsnum); }) $('body').on('click','.login-close',function(){ layer.closeall(); layeris = false; }) }) // 职位列表 $('.job-list-b').on('click','.job-list-open',function(){ $(this).parent().toggleclass('on').siblings().removeclass('on'); $(this).next().slidetoggle().parent().siblings().find('dd').slideup(); }) // 登录密码显示切换 $('.pass-switch').hover(function(){ $(this).find('i').toggle(); $(this).next().attr('type','text'); },function(){ $(this).find('i').toggle(); $(this).next().attr('type','password'); }); //快捷导航 $('.top-r dt').click(function(){ if($('.nav-box .container').outerwidth()<960){ $(this).parent().toggleclass('on'); $(this).next().toggleclass('show e-animte-show'); } }) $('.top-r dl').hover(function(){ if($('.nav-box .container').outerwidth()>=960){ $(this).addclass('on'); $(this).find('dd').addclass('show e-animte-show'); } },function(){ if($('.nav-box .container').outerwidth()>=960){ $(this).removeclass('on'); $(this).find('dd').removeclass('show e-animte-show'); } }); //搜索框 $('.search-btn a').click(function(){ $('.search-btn').toggleclass('search-btn-on'); $('.search-bg').toggleclass('search-bg-show e-animte-show'); }) //底部微信 $('.follow a').click(function(){ if($('.nav-box .container').outerwidth()<960){ $(this).parent().toggleclass('on'); $(this).next().toggleclass('show e-animte-show'); } }) $('.follow a').hover(function(){ if($('.nav-box .container').outerwidth()>=960){ $(this).parent().addclass('on'); $(this).next().addclass('show e-animte-show'); } },function(){ if($('.nav-box .container').outerwidth()>=960){ $(this).parent().removeclass('on'); $(this).next().removeclass('show e-animte-show'); } }); //友情链接 $('.link-btn').click(function(){ $(this).toggleclass('on'); $(this).find('dd').toggleclass('show e-animte-show'); }) $('.link-btn').hover(function(){ if($('.nav-box .container').outerwidth()>=960){ $(this).addclass('on'); $(this).find('dd').addclass('show e-animte-show'); } },function(){ if($('.nav-box .container').outerwidth()>=960){ $(this).removeclass('on'); $(this).find('dd').removeclass('show e-animte-show'); } }); //鼠标经过动画 $('.e-anim').hover(function(){ $(this).addclass('anim-on').removeclass('anim-off'); },function(){ $(this).addclass('anim-off').removeclass('anim-on'); }); //鼠标经过显示隐藏动画 $('.e-anim-switch').hover(function(){ $(this).find('.e-anim-hide').addclass('e-anim-on').removeclass('e-anim-off'); },function(){ $(this).find('.e-anim-hide').addclass('e-anim-off').removeclass('e-anim-on'); $(this).find('.e-anim-hide')[0].addeventlistener('animationend', function () { $(this).removeclass('e-anim-off'); }); }); //组织架构 $('.institution-box').on('click','.btn',function(){ if($('.nav-box .container').outerwidth()<960){ if($(this).next().hasclass('e-anim-hide')){ if(!$(this).next().hasclass('e-anim-on')){ $(this).addclass('m-on'); $(this).next('.e-anim-hide').addclass('e-anim-on').removeclass('e-anim-off'); }else{ $(this).removeclass('m-on'); $(this).next('.e-anim-hide').addclass('e-anim-off').removeclass('e-anim-on'); $(this).next('.e-anim-hide')[0].addeventlistener('animationend', function () { $(this).removeclass('e-anim-off'); }); } } }else{ if($(this).next().hasclass('e-anim-hide')){ $('.column-box').html(''); $(this).toggleclass('pc-on').parent().siblings().find('.btn').removeclass('pc-on'); if($(this).hasclass('pc-on')){ $('.column-box').html('
'+$(this).next().html()+'
'); } } } }); //组织架构电脑4级 $('.column-box').on('click','.btn',function(){ if($(this).next().hasclass('e-anim-hide')){ if(!$(this).next().hasclass('e-anim-on')){ $(this).addclass('pc-on'); $(this).parent().addclass('pc-show'); $(this).next('.e-anim-hide').addclass('e-anim-on').removeclass('e-anim-off'); }else{ $(this).removeclass('pc-on'); $(this).parent().removeclass('pc-show'); $(this).next('.e-anim-hide').addclass('e-anim-off').removeclass('e-anim-on'); $(this).next('.e-anim-hide')[0].addeventlistener('animationend', function () { $(this).removeclass('e-anim-off'); }); } } }); //点击导航外收起 $('html').click(function(){ closenav(); $('.top-r dl').removeclass('on').find('dd').removeclass('show e-animte-show'); }) //导航链接判断 $('.nav li>a').click(function(e){ if($('.nav-box .container').outerwidth()<960 && $(this).next('.nav-list-sub').length>0){ stopdefault(e); } }) //移动端导航事件 $('.nav-btn').click(function(event){ propagation(); $('body').animate({scrolltop:0},100); $(this).toggleclass('nav-btn-show'); $('.body-box').toggleclass('body-box-show'); $('.nav-box').toggleclass('nav-box-show'); $('.nav').toggleclass('nav-show e-animte-show'); $('.nav-bg-02').toggleclass('nav-bg-02-show'); $('.top-r dl').removeclass('on').find('dd').removeclass('show e-animte-show'); }); $('.nav li').click(function(){ if($('.nav-box .container').outerwidth()<960){ $(this).toggleclass('nav-on').siblings().removeclass('nav-on'); var navsubh = $(this).hasclass('nav-on') ? $(this).find('.nav-list-height').outerheight() : 0; $(this).find('.nav-list-sub').css('height',navsubh).parent().siblings().find('.nav-list-sub').css('height',0); $('.top-r dl').removeclass('on').find('dd').removeclass('show e-animte-show'); } }); $('.nav-box').click(function(event){ propagation(); }); //pc端导航事件 $('.nav li').mouseenter(function(){ if($('.nav-box .container').outerwidth()>=960){ $('.nav li').removeclass('nav-on'); $(this).find('.e-animte').addclass('e-animte-show'); $(this).addclass('nav-on').siblings().addclass('nav-off'); if($('.nav-list li .on').length >= 1){ $('.nav-list li .on .nav-btn-bg').css({'left':$(this).offset().left-$('.nav-list .on').offset().left,'width':$(this).width()})//个别特殊网站可加入误差修正 }else{ $('.nav-btn-bg-02').addclass('nav-btn-bg-02-show').css({'left':$(this).offset().left-$('.nav-list').offset().left-1,'width':$(this).width()}) } if($(this).find('.nav-list-height').length>0){ //二级下拉背景色 $('.nav-list-sub-bg').addclass('e-animte-show nav-list-sub-bg-show'); } } }); $('.nav li').mouseleave(function(){ if($('.nav-box .container').outerwidth()>=960){ $(this).find('.e-animte').removeclass('e-animte-show'); $(this).removeclass('nav-on').siblings().removeclass('nav-off'); $('.nav-list li .on .nav-btn-bg').removeattr('style'); //二级下拉背景色 $('.nav-list-sub-bg').removeclass('e-animte-show nav-list-sub-bg-show'); } }); $('.nav-list').mouseleave(function(){ $('.nav-btn-bg-02').removeclass('nav-btn-bg-02-show').removeattr('style'); }) //menu $('.menu-line').each(function(){ var nemul = 0; $('.menu-r .on').length>0?nemul = $('.menu-r .on').position().left:nemul; var nemuw = 0; $('.menu-r .on').length>0?nemuw = $('.menu-r .on').width():nemuw; $('.menu-line').css({'width':nemuw,'left':nemul}); }) $('.menu-r a').mouseenter(function(){ $('.menu-line').css({'width':$(this).width(),'left':$(this).position().left}); }) $('.menu-r').mouseleave(function(){ var nemuw = 0; $('.menu-r .on').width()?nemuw = $('.menu-r .on').width():nemuw; if($('.menu-r .on').length>0){ $('.menu-line').css({'width':nemuw,'left':$('.menu-r .on').position().left}); }else{ $('.menu-line').css({'width':nemuw}); } }); //user $('.user-line').each(function(){ var userl = 0; $('.user-tit-l .on').length>0?nemul = $('.user-tit-l .on').position().left:userl; var userw = 0; $('.user-tit-l .on').length>0?userw = $('.user-tit-l .on').width():userw; $('.user-line').css({'width':userw,'left':nemul}); }) $('.user-tit-l a').mouseenter(function(){ $('.user-line').css({'width':$(this).width(),'left':$(this).position().left}); }) $('.user-tit-l').mouseleave(function(){ var nemuw = 0; $('.user-tit-l .on').width()?nemuw = $('.user-tit-l .on').width():nemuw; if($('.user-tit-l .on').length>0){ $('.user-line').css({'width':nemuw,'left':$('.user-tit-l .on').position().left}); }else{ $('.user-line').css({'width':nemuw}); } }); //实用简易切换普通 $('.tabs-box-ord').each(function(){ $(this).find('.hd-ord>*').eq(0).addclass('on'); $(this).find('.bd-ord>*').eq(0).show().siblings().hide(); $(this).find('.bdl-ord>*').eq(0).show().siblings().hide(); }) $('.tabs-box-ord .hd-ord>*').on('click',function(e){ $(this).addclass('on').siblings().removeclass('on'); $(this).parents('.tabs-box-ord').find('.bd-ord>*').eq($(this).index()).show().siblings().hide(); $(this).parents('.tabs-box-ord').find('.bdl-ord>*').eq($(this).index()).show().siblings().hide(); /*tabsressize(this);*/ }) //返回顶部 $('.totop').click(function(){ $('html,body').animate({scrolltop:0}, document.body.scrollheight/10); }) //浏览器版本提示 mybrowser(); var tips ="
您当前的浏览器版本过低,网站部分功能将无法正常显示,请更新您的浏览器。
"; if (mybrowser() == "ff") { } if (mybrowser() == "opera") { } if (mybrowser() == "safari") { } if (mybrowser() == "ie55") { $("body").prepend(tips); } if (mybrowser() == "ie6") { $("body").prepend(tips); } if (mybrowser() == "ie7") { $("body").prepend(tips); } if (mybrowser() == "ie8") { $("body").prepend(tips); } }); $(window).scroll(function() { }); var sizetimer = null; $(window).resize(function() { cleartimeout(sizetimer); sizetimer = settimeout(function(){ navl(); autoheight(); },400); }); $(window).load(function() { }); //更新tabs高度 function tabsressize(obj){ if($(obj).parents('.tabs-on').length){ $(obj).parents('.tabs-box').find('.bd').css('height',$(obj).parents('.tabs-box').find('.tabs-on').outerheight()); }else{ $(obj).parents('.tabs-box').find('.bd').css('height',$(obj).parents('.tabs-box').find('.tabs-show').outerheight()); } } //浏览器版本判断 function mybrowser(){ var useragent = navigator.useragent; //取得浏览器的useragent字符串 var isopera = useragent.indexof("opera") > -1; //判断是否opera浏览器 var isie = useragent.indexof("compatible") > -1 && useragent.indexof("msie") > -1 && !isopera; //判断是否ie浏览器 var isff = useragent.indexof("firefox") > -1; //判断是否firefox浏览器 var issafari = useragent.indexof("safari") > -1; //判断是否safari浏览器 if (isie) { var ie5 = ie55 = ie6 = ie7 = ie8 = false; var reie = new regexp("msie (\\d+\\.\\d+);"); reie.test(useragent); var fieversion = parsefloat(regexp["$1"]); ie55 = fieversion == 5.5; ie6 = fieversion == 6.0; ie7 = fieversion == 7.0; ie8 = fieversion == 8.0; if (ie55) { return "ie55"; } if (ie6) { return "ie6"; } if (ie7) { return "ie7"; } if (ie8) { return "ie8"; } }//isie end if (isff) { return "ff"; } if (isopera) { return "opera"; } } //获取左偏移值 function navl(){ if($('.nav-box .container').outerwidth()>=960){ $(this).find('.nav-list-sub').removeattr('style'); $('.nav li').each(function(){ var lmax = $('.nav').position().left+$(this).position().left+$(this).find('.nav-list-height').outerwidth()-$('.logo').position().left; //判断左偏移加宽度是否超出 if(lmax > $('.nav-box .container').width()){ var l = $('.nav-box .container').width() - lmax; $(this).find('.nav-list-sub').css('width',$(this).find('.nav-list-height').outerwidth()+1); $(this).find('.nav-list-sub').css('left',l); }else{ $(this).find('.nav-list-sub').css('width',$(this).find('.nav-list-height').outerwidth()+1); } }); }else{ $('.nav-list-sub').css('width',''); } } //swiper2.x,auto显示数量 function swipersl(cla,obj,ss,mm,ll){ swiperdx(cla,obj,ss,mm,ll); $(window).resize(function() { swiperdx(cla,obj,ss,mm,ll); }); } function swiperdx(c,o,s,m,l){ var w = $('.container').outerwidth(); var x = $(c).outerwidth(); if(w>=960){ $(c).find('.swiper-slide').css('width',x/l); }else if(w>=720){ $(c).find('.swiper-slide').css('width',x/m); }else{ $(c).find('.swiper-slide').css('width',x/s); } o.resizefix(); } //收起导航 function closenav(){ $('.nav-btn').removeclass('nav-btn-show'); $('.body-box').removeclass('body-box-show'); $('.nav-box').removeclass('nav-box-show'); $('.nav').removeclass('nav-show e-animte-show'); $('.nav-bg-02').removeclass('nav-bg-02-show'); // $('.lang dd').slideup(50); // $('.footer-r dd').hide(); // $(".kcxz-box dd").hide(); // $('.nav-r .search-bd').removeclass('search-bd-show'); $('.yqlj-box dd').removeclass('show e-animte-show'); $('.search').removeclass('search-show'); $('.search-box').removeclass('search-show'); $('.nav-list').removeclass('nav-list-min'); } //阻止冒泡事件 function propagation(){ if (event.stoppropagation) { // this code is for mozilla and opera event.stoppropagation(); } else if (window.event) { // this code is for ie window.event.cancelbubble = true; } } //阻止跳转 function stopdefault(e) { if ( e && e.preventdefault ) e.preventdefault(); else window.event.returnvalue = false; return false; } //设备横竖屏判断 window.addeventlistener("onorientationchange" in window ? "orientationchange" : "resize", function() { //竖屏 if (window.orientation === 180 || window.orientation === 0) { $('html').removeclass('landscape'); } //横屏时提示 if (window.orientation === 90 || window.orientation === -90 ){ $('html').addclass('landscape'); } }, false); //进入全屏 function enterfullscreen() { var de = document.documentelement; if (de.requestfullscreen) { de.requestfullscreen(); } else if (de.mozrequestfullscreen) { de.mozrequestfullscreen(); } else if (de.webkitrequestfullscreen) { de.webkitrequestfullscreen(); } } //退出全屏 function exitfullscreen() { var de = document; if (de.exitfullscreen) { de.exitfullscreen(); } else if (de.mozcancelfullscreen) { de.mozcancelfullscreen(); } else if (de.webkitcancelfullscreen) { de.webkitcancelfullscreen(); } } //判断是否全屏 $(window).resize(function() { var fullscreenelement = document.fullscreenenabled || document.mozfullscreenelement || document.webkitfullscreenelement; var fullscreenenabled = document.fullscreenenabled || document.mozfullscreenenabled || document.webkitfullscreenenabled; if (fullscreenelement == null) { //非全屏 $('.icon-fullscreen').show(); $('.icon-fullexit').hide(); } else { //全屏 $('.icon-fullscreen').hide(); $('.icon-fullexit').show(); } }); //视频背景居中 function bgvideo(id,opt){ var bgvideo = document.getelementbyid(id); var vidh = opt.height?opt.height:document.body.offsetwidth; var videowh,videovw,videovh,videotime; //视频初始化 bgvideo.onresize = function(){ videosize(); } document.read = function(){ cleartimeout(videotime) videotime = settimeout(function(){videosize()},50); } addeventonload(function(){ cleartimeout(videotime) videotime = settimeout(function(){videosize()},50); }) addeventonresize(function(){ cleartimeout(videotime) videotime = settimeout(function(){videosize()},50); }) //视频背景缩放计算 function videosize(){ videovw = bgvideo.videowidth; videovh = bgvideo.videoheight; videowh =videovw/videovh; var windoww = document.documentelement.clientwidth; var windowh = vidh; //宽高比例比较 if( windoww / windowh > videowh ){ // bgvideo.classlist.add('video-bg-w'); // bgvideo.classlist.remove('video-bg-h'); bgvideo.style.width = windoww+'px'; bgvideo.style.height = windoww/videowh+'px'; }else{ // bgvideo.classlist.add('video-bg-h'); // bgvideo.classlist.remove('video-bg-w'); bgvideo.style.height = windowh+'px'; bgvideo.style.width = windowh*videowh+'px'; } } } //多个ready function addeventready(fn){ var originfn = document.ready document.ready =function () { originfn && originfn() fn() } } //多个onload function addeventonload(fn){ var originfn = window.onload window.onload =function () { originfn && originfn() fn() } } //多个onresize function addeventonresize(fn){ var originfn = window.onresize window.onresize =function () { originfn && originfn() fn() } } //当前日期 function presenttime(){ var show_day=new array('星期日','星期一','星期二','星期三','星期四','星期五','星期六'); var time=new date(); var year=time.getfullyear(); var month=time.getmonth(); var date=time.getdate(); var day=time.getday(); var hh=time.gethours(); var mm=time.getminutes(); var ss=time.getseconds(); month=month+1; month<10?month='0'+month:month; date<10?date='0'+date:date; hh<10?hh='0'+hh:hh; mm<10?mm='0'+mm:hh; ss<10?ss='0'+ss:hh; var now_time=''+year+'年'+month+'月'+date+'日'+' '+show_day[day]+''; $('#present-time').html(now_time); } setinterval(presenttime,100); //滑动监听 var th,tht; var isscroll = false; $(window).on('touchstart',function(e) { clearinterval(tht); th = 0; }); $(window).scroll(function(e) { if(isscroll){ clearinterval(tht); $('.pf-box').addclass('pf-nav-off'); th = 0; tht = setinterval(function(){ th++; if(th>5){ clearinterval(tht); $('.pf-box').removeclass('pf-nav-off'); clearinterval(tht); } }, 50); }else{ isscroll = true; } }); //tabs切换 function tabs(cla,opt){ var obj = this; var oh,nh;//切换前后的高度 //opt接受的参数 var clickevent = true;//是否接受点击事件 var mouseenterevent = true;//是否接受鼠标经过事件 var fun;//切换后的回调,function(index){},返回切换后的index值 //获取定义值 if(opt){ clickevent = opt.clickevent != null?opt.clickevent:clickevent; mouseenterevent = opt.mouseenterevent != null?opt.mouseenterevent:mouseenterevent; fun = opt.fun?opt.fun:''; } var event =''; clickevent?event +=' click':''; mouseenterevent?event +=' mouseenter':''; //鼠标触发切换事件 $(cla).find('.hd>*').on(event,function(e){ //手机版阻止切换按钮的链接跳转 if($('.nav-box .container').outerwidth()<960){ stopdefault(e); } if(!$(this).hasclass('on')){ //获取切换后的index var index = $(this).index(); obj.tabsswitch(index); } }) //tabs方法 //切换方法 obj.tabsswitch = function(i){ //获取切换前高度 oh = $(cla).find('.e-anim-on').outerheight(); $(cla).find('.bd').css({'height':oh}); $(cla).find('.hd>*').eq(i).addclass('on').siblings().removeclass('on'); $(cla).find('.hd-line').css({'width':$(cla).find('.hd .on').width(),'left':$(cla).find('.hd .on').position().left}); $(cla).find('.bdl>*').eq(i).show().siblings().hide(); $(cla).find('.bd>.e-anim-on').removeclass('e-anim-on').addclass('e-anim-off'); $(cla).find('.bd>*').eq(i).removeclass('e-anim-off').addclass('e-anim-on'); //获取切换后高度 nh = $(cla).find('.e-anim-on').outerheight(); $(cla).find('.bd').css({'height':nh}); $(cla).find('.bd>*').each(function(){ $(this)[0].addeventlistener('animationend', function () { $(this).removeclass('e-anim-off'); //去除高度 $(this).parents('.bd').css({'height':''}); }) }); //切换后回调 fun?fun(i):''; } //初始化 $(cla).find('.bd>*').addclass('e-anim-hide'); obj.tabsswitch(0); } //字符截取 function substr(str,length){ var a=str.match(/[^\x00-\xff]|\w{1,2}/g); return a.length$('.nav-box').outerheight()+$('.banner-min').outerheight()+$('.banner-box').outerheight()+$('.ind-box').outerheight()+$('.footer-bg').outerheight()){ $('.ind-box').css('min-height',$(window).height()-$('.nav-box').outerheight()-$('.banner-min').outerheight()-$('.banner-box').outerheight()-$('.footer-bg').outerheight()); } } function removenewsstyle(cla){ var p = cla+' p'; var span = cla+' span'; var strong = cla+' strong'; var img = cla+' img'; //新闻过滤样式 $(p+','+span+','+strong).each(function(index,el){ //过滤样式 var ta = $(this).css("text-align"); var col = $(this).css("color"); $(this).removeattr('style'); $(this).css('text-align',ta); $(this).css('color',col); //居中去掉缩进 if(ta == "center"){ $(this).addclass('info-box-ti0'); } //空内容隐藏 if($(this).text() == '' && $(this).find('img').length == 0){ $(this).attr('data-mess','隐藏图片'); $(this).hide(); } //只有空格隐藏 if($(this).text().match(/^\s+$/)){ $(this).attr('data-mess','隐藏内容'); $(this).hide(); } }) //去掉图片的样式 $(img).each(function(index,el){ $(this).attr('style',''); $(this).parents('p').addclass('info-box-img'); $(this).parents('p'); //特定图片 if($(this).attr('src').split('ueditor').length >= 2){ $(this).addclass('info-box-img-detach'); } }) //显示被误隐藏图片 $('.info-box-img').css('display','block'); //去掉图片附近的回车 $('.info-box-img br').remove(); //去掉文字中带有的空格 $(p+','+span+','+strong).each(function(index,el){ $(this).html($(this).html().replace(/ /ig,'')); $(this).html($(this).html().replace(/\n[\s| | ]*\r/g,'')); }) }