// JavaScript Document $(document).ready(function() { new WOW().init(); navl(); contHeight(); layui.use('layer', function(){ var layer = layui.layer; //相册弹层 layer.photos({ photos: '#layer-photos' ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) ,shade: .85 }); $('.participants-table').wrapAll('
'); $('.jcsp-list a').click(function(e){ stopDefault(e); var url = $(this).attr('href'); $("#video").attr('src',url); var video = document.getElementById("video"); video.play(); layer.open({ type: 1, title: false, shade: 0.8, skin:'video-show', content: $('.jcsp-video'), cancel: function(index, layero){ $("#video").attr('src',''); video.pause(); } }); }); }) $(window).scroll(function(){ var topp = $(document).scrollTop(); if(topp > 500){ $('.top-box').addClass('top-show').removeClass('top-hide'); }else{ $('.top-box').removeClass('top-show').addClass('top-hide'); } }) //点击导航外收起 $('html').click(function(){ closeNav(); }) //导航链接判断 $('.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'); }); $('.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); } }); $('.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'); }) //顶部下拉 $('.header-r-btn').mouseenter(function(){ if($('.nav-box .container').outerWidth()>=960){ $(this).addClass('header-r-btn-on'); $(this).find('.e-animte').addClass('e-animte-show'); } }); $('.header-r-btn').mouseleave(function(){ $(this).removeClass('header-r-btn-on'); $(this).find('.e-animte').removeClass('e-animte-show'); }) //字体大小 var fontSize = ['f-minn','f-min','f-medium','f-max','f-maxx']; $('.font-btn').click(function(){ var i = 0; var fontIs = false; //判断加减 if($(this).hasClass('font-enlarge')){ i = 1; }else{ i = -1; } //获取当前字体尺寸 var size = parseInt($('.news-content').attr('data-size')); //新尺寸 size = size+i; //赋值新的尺寸 if( i < 0){ if(size >= 0){ fontIs =true; } }else{ if(size <= fontSize.length-1){ fontIs =true; } } if(size >= fontSize.length-1 || size <= 0){ $(this).addClass('font-btn-off'); }else{ $('.font-btn').removeClass('font-btn-off'); } if(fontIs){ $('.news-content').attr('data-size',size); $('.news-content').removeClass('f-maxx f-max f-medium f-min f-minn').addClass(fontSize[size]); } }) //实用简易切换普通 $('.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);*/ }) //简易切换动画版 //遍历 $('.tabs-box').each(function(){ $(this).find('.hd>*').eq(0).addClass('on'); $(this).find('.bd>*').eq(0).addClass('tabs-on e-animte-show').siblings().addClass('tabs-hide'); $(this).find('.bdl>*').eq(0).show().siblings().hide(); /*$(this).find('.bd').css('height',$(this).find('.tabs-on').outerHeight());*/ }) //切换事件 $('.tabs-box .hd>*').on('click',function(e){ if($('.nav-box .container').outerWidth()<960){ stopDefault(e); } if(!$(this).hasClass('on')){ $(this).parents('.tabs-box').find('.bd>*').removeClass('tabs-on'); $(this).addClass('on').siblings().removeClass('on'); $(this).parents('.tabs-box').find('.bd>*').eq($(this).index()).addClass('tabs-show e-animte-show').removeClass('tabs-hide').siblings().removeClass('tabs-show e-animte-show').addClass('tabs-hide'); $(this).parents('.tabs-box').find('.bdl>*').eq($(this).index()).show().siblings().hide(); /*$(this).parents('.tabs-box').find('.bd').css('height',$(this).parents('.tabs-box').find('.tabs-show').outerHeight());*/ } }) //窗口改变重置大小 /* $(window).resize(function() { setTimeout( function(){ $('.tabs-box').each(function(){ if($(this).find('.e-animte').hasClass('tabs-on')){ $(this).find('.bd').css('height',$(this).find('.tabs-on').outerHeight()); }else{ $(this).find('.bd').css('height',$(this).find('.tabs-show').outerHeight()); } }) }, 300 ); });*/ //返回顶部 $('.to-top').click(function(){ $('html,body').animate({scrollTop:0}, document.body.scrollHeight/10); }) //关闭浮窗 $('.pf-close').click(function(){ $('.pf-nav').addClass('pf-nav-hide'); }) //修改资料 $('.edit-switch').click(function(){ $(this).parents('form').removeClass('edit-off'); contHeight(); }) //显示地图 $('.map-btn').click(function(){ if($('.nav-box .container').outerWidth()<960){ window.open('https://map.baidu.com/mobile/webapp/search/search/qt=s&wd='+$(this).attr('data-map')+'/vt=map',"_blank"); }else{ window.open('https://map.baidu.com/search/?querytype=s&da_src=shareurl&wd='+$(this).attr('data-map'),"_blank"); } return false; }) //收起条件 var hrIs = true; $('.hr-search-switch').click(function(){ if(hrIs){ $('.hr-search-switch').addClass('hr-search-switch-off'); $('.hr-search-radio-box').slideUp(); $(this).find('small').html('展开条件'); hrIs = false; }else{ $('.hr-search-switch').removeClass('hr-search-switch-off'); $('.hr-search-radio-box').slideDown(); $(this).find('small').html('收起条件'); hrIs = true; } }); //浏览器版本提示 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(){ contHeight(); navl(); },400); }); $(window).load(function() { contHeight(); /*tabsRessize('.tabs-box-ord');*/ sizeTimer = setTimeout(function(){ contHeight(); },400); }); //更新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-list').position().left+$(this).position().left+$(this).find('.nav-list-height').outerWidth(); //判断左偏移加宽度是否超出 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'); } //阻止冒泡事件 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); //加载列表函数 function loadList(cla,opt){ var source = opt.source ? opt.source : 'null'; var d = [];//保存返回数据 var eNum;//每页显示数量 var eTotal;//总数 var ePages;//页数 $(cla).html(''); $.get(source,function(data,success){ d = data;//获取数据 eTotal = d.list.length; //总页数 if(typeof(opt.num) == "object"){ if($('.nav-box .container').outerWidth()<960){ eNum = opt.num[0]; }else{ eNum = opt.num[1]; } }else{ eNum = opt.num ? opt.num : 3; } var ePages = Math.ceil(eTotal/eNum);//总页数 var o; //创建列表 list(0); //创建分页 $(cla).append(''); if(opt.prev){ $(cla).find('.load-pages').append('
  • '); } for( var i = 0 ; i < ePages ; i++){ if(i == 0){ o = 'on'; }else{ o = ''; } $(cla).find('.load-pages').append('
  • '+(i+1)+'
  • '); } if(opt.next){ $(cla).find('.load-pages').append('
  • '); } if(opt.more){ $(cla).find('.load-pages').append('
  • '+opt.more+'
  • '); } }).error(function(){ //失败提示 $(cla).append('
    暂无信息
    '); }) //点击翻页 $(cla).on('click','.load-pages-btn',function(){ $(this).addClass('on').parent().siblings().find('a').removeClass('on'); list($(this).attr('data-page')); }) //点击上一页 $(cla).on('click','.page-prev',function(){ if($(cla).find('.load-pages .on').attr('data-page') > 0){ var page = parseInt($(cla).find('.load-pages .on').attr('data-page'))-1; $(cla).find('.load-pages .on').parent().prev().children().addClass('on').parent().siblings().find('a').removeClass('on'); list(page); } }) //点击下一页 $(cla).on('click','.page-next',function(){ if($(cla).find('.load-pages .on').attr('data-page') < ePages-1){ var page = parseInt($(cla).find('.load-pages .on').attr('data-page'))+1; $(cla).find('.load-pages .on').parent().next().children().addClass('on').parent().siblings().find('a').removeClass('on'); list(page); } }) //列表 function list(n){ var n = parseInt(n); $(cla).find('.load-list').remove(); $(cla).prepend(''); var i = eNum*n; //计算总页数 var p = eNum*(n+1) < eTotal ? eNum*(n+1) : eTotal ; for(i;i < p ; i++){ var mess = opt.each(d,i); $(cla).find('.load-list').append(mess); } } } //滑动监听 var th,tht; var isScroll = false; $(window).on('touchstart',function(e) { clearInterval(tht); th = 0; }); $(window).scroll(function(e) { if(isScroll){ clearInterval(tht); $('.pf-nav').addClass('pf-nav-off'); th = 0; tht = setInterval(function(){ th++; if(th>5){ clearInterval(tht); $('.pf-nav').removeClass('pf-nav-off'); clearInterval(tht); } }, 50); }else{ isScroll = true; } }); //内容高度计算 function contHeight(){ if($('.nav-box .container').outerWidth()>=960){ $('.content-bd-min').css('height','auto'); if($('.admin-l').height()<=$('.admin-r').height()){ $('.content-bd-min').css('height',$('.admin-r').height()+40); }else{ $('.content-bd-min').css('height',$('.admin-l').height()+40); } }else{ $('.content-bd-min').css('height','auto'); } } //弹出视频 function videoPlay(url){ var arr = url.split("."); if(arr[arr.length-1] == "mp4"){ var html = '' layer.open({ type: 1, title: false, shade: 0.8, skin:'video-show', content: html }); }else{ layer.open({ type: 2, title: false, shade: 0.8, skin:'video-show', content: url }); } var video = $('#videoBox'); //console.log(video); //通过打印拿到所有的属性和方法 video[0]['disablePictureInPicture'] = true; //disablePictureInPicture的属性改为true }