$(function(){ var browser = (function(){ var ua = window.navigator.userAgent.toLowerCase(), sys = null, s; if(s = ua.match(/rv:([\d.]+)\) like gecko/)){sys = {type:'ie',version:s[1]};} else if(s = ua.match(/msie ([\d.]+)/)){sys = {type:'ie',version:s[1]};} else if(s = ua.match(/firefox\/([\d.]+)/)){sys = {type:'firefox',version:s[1]};} else if(s = ua.match(/chrome\/([\d.]+)/)){sys = {type:'chrome',version:s[1]};} else if(s = ua.match(/opera.([\d.]+)/)){sys = {type:'opera',version:s[1]};} else if(s = ua.match(/version\/([\d.]+).*safari/)){sys = {type:'safari',version:s[1]};} else if(s = ua.match(/ucbrowser\/([\d.]+)/)){sys = {type:'uc',version:s[1]};} else if(s = ua.match(/micromessenger\/([\d.]+)/)){sys = {type:'wx',version:s[1]};} else{sys = {type:'unknown',version:'unknown'};} sys.isMobile = !!ua.match(/AppleWebKit.*Mobile.*!/) || !!ua.match(/(iPhone|iPod|Android|ios|iPad)/i); return sys; })(); /*检测IE*/ if(browser.type =="ie" && browser.version >=9){ $('html').addClass('iehtml'); } if(browser.type =="ie" && browser.version < 9){ location.href=""; } /*导航*/ var navAnimate = new TimelineMax(); navAnimate.to( ".p-menuModal",0,{left:"100%"},0 ); navAnimate.staggerTo( ".modal_menu li",0.1,{opacity:0,y:5,x:5},0 ); navAnimate.to( ".modal_closebtn",0,{opacity:0},0 ); $(".menu_btn").bind("click",function(){ // console.log(1) $("html").addClass("overflow"); var navAnimate = new TimelineMax(); navAnimate.to( ".p-menuModal",0.5,{delay:0.2,left:0,opacity:1, ease: Linear.easeIn},0.2 ); navAnimate.staggerTo( ".modal_menu li",.5,{opacity:1,y:0,x:0, ease: Linear.easeIn},.05 ); navAnimate.to( ".modal_closebtn",0.2,{opacity:1, ease: Linear.easeIn},0.2 ); }) $(".modal_closebtn").bind("click",function(){ // console.log(1) $("html").removeClass("overflow"); var navAnimate = new TimelineMax(); navAnimate.to( ".p-menuModal",0.5,{delay:0.2,left:"100%",opacity:1, ease: Linear.easeOut},0.2 ); navAnimate.staggerTo( ".modal_menu li",.5,{opacity:0,y:5,x:5, ease: Linear.easeOut},.05 ); navAnimate.to( ".modal_closebtn",0.2,{opacity:0, ease: Linear.easeOut},0.2 ); }) jQuery.jqtab = function(tabtit,tab_conbox,shijian) { $(tab_conbox).find(".item").hide(); $(tabtit).find("li:first").addClass("on").show(); $(tab_conbox).find(".item:first").show(); $(tabtit).find("li").bind(shijian,function(){ $(this).addClass("on").siblings("li").removeClass("on"); var activeindex = $(tabtit).find("li").index(this); $(tab_conbox).children().eq(activeindex).show().siblings().hide(); return false; }); }; /*调用方法如下:*/ $.jqtab(".js_newstab .tit",".js_newstab .cont","click"); $.jqtab(".list_departpage .tit",".list_departpage .cont","click"); /*历史沿革*/ (function(){ var mapMove=false, _x; var wwidth = $('.js_historyimg .photo').width(); $('.js_historyimg .photo .ctrl').on('mousedown touchstart',function(e){ e.preventDefault() mapMove=true; _x=e.pageX-parseInt($(this).position().left) || e.originalEvent.targetTouches[0].pageX-parseInt($(this).position().left); $(document).on('mousemove touchmove',mMove); }); $(document).on('mouseup touchend',function(){ move=false; $(document).off('mousemove touchmove',mMove); }); function mMove(e){ e.preventDefault() if(mapMove){ var x=(e.pageX-_x) || (e.originalEvent.targetTouches[0].pageX-_x); if(x<0){ x=0; }else if(x>wwidth){ x=wwidth; } $('.js_historyimg .photo .ctrl').css('left',x+'px'); $('.js_historyimg .photo .mask').css('width',(wwidth-x)+'px'); } } })(); /*左侧导航*/ $('.left_menu li').hover(function(){ if($(this).children('dl').length != 0){ $(this).children('dl').stop(false,false).slideDown(); } },function(){ if(!$(this).hasClass('active')){ $(this).children('dl').stop(false,false).slideUp(); } }) var swipernewsimg = new Swiper('.js_newsimg', { pagination: '.swiper-pagination', paginationClickable: true, preventClicks : false,//默认true nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', spaceBetween:20, loop:true, paginationClickable: true, autoplay : 5000, autoplayDisableOnInteraction: false }); $(".js_newsimg").mouseover(function(){ swipernewsimg.stopAutoplay(); }); $(".js_newsimg").mouseout(function(){ swipernewsimg.startAutoplay(); }); var swiper2 = new Swiper('.js_international', { pagination: '.swiper-pagination', paginationClickable: true, preventClicks : false,//默认true nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', slidesPerView: 3, spaceBetween: 40, breakpoints: { 991: { slidesPerView: 3, spaceBetween: 10 }, 480: { slidesPerView: 1 } } }); var swiper = new Swiper('.js_wy .swiper-container', { pagination: '.swiper-pagination', paginationClickable: true, preventClicks : false,//默认true slidesPerView: 4, spaceBetween: 27, nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', breakpoints: { 1024: { slidesPerView: 4 }, 768: { slidesPerView: 2 }, 480: { slidesPerView: 1 } } }); $('.recurit_list li .title').on("click", function () { $(this).toggleClass("on"); $('.recurit_list li .title').not($(this)).removeClass("on"); $(this).next().slideToggle(100); $('.recurit_list li .cont').not($(this).next()).slideUp('fast'); }); })