var ismobile = false, w_width = 0, w_height = 0, $mtoph = 0, st = 0, navitem = 0, $menubtn=$('.menu-handler'), $menubox=$(".menubox"); //移动端事件和pc事件的切换 var _mousemove; var _click; var _mousedown; var _mouseup; if (modernizr.touch) { _mousemove = "touchmove"; _click = "touchend"; _mousedown = "touchstart"; _mouseup = "touchend"; _mouseenter = "touchend"; } else { _mousemove = "mousemove"; _click = "click"; _mousedown = "mousedown"; _mouseup = "mouseup"; _mouseenter = "mouseenter"; }; function pagebox() { w_width = $(window).width(); w_height = $(window).height(); $mtoph = $('.mtop').height(); // if(!ismobile){ // $mtoph = $mtoph + 40; // } if (w_width <= 1024) { ismobile = true; } else if (w_width > 1024) { ismobile = false; }; if(ismobile){ var dannum=0; $('.pnav ul').css('display','none'); $('.pnav').bind(_click,function(){ if(dannum==1){ $(this).removeclass('show'); $(this).find('ul').stop().fadeout(); dannum = 0; }else{ $(this).addclass('show'); $(this).find('ul').stop().fadein(); dannum = 1; } }); }else{ $('.pnav').removeclass('show'); $('.pnav ul').css('display','block'); $('.pnav').unbind(_click); } }; pagebox(); $(window).resize(function () { pagebox(); }); $(function () { $('.fix-ma .close').bind(_click, function(){ $(this).parent().addclass('hide'); }); var isopen = 0; $('.flinkmore .t').bind(_click, function(){ if(isopen==0){ isopen = 1; $(this).addclass('act'); $('.flinkmore ul').stop().slidedown(300); }else{ isopen = 0; $(this).removeclass('act'); $('.flinkmore ul').stop().slideup(300); } }); $('.flinkmore').mouseleave(function(){ isopen = 0; $('.flinkmore .t').removeclass('act'); $('.flinkmore ul').stop().slideup(300); }); $(window).scroll(function () { var windowtop = $(window).scrolltop(); if (windowtop < w_height && !ismobile) { $('.pbanner .pic2 img').css('transform', "translate(0px," + (windowtop) / 1.5 + "px)"); }; changeheader(); changepnav(); }); function changeheader(){ var st = $(window).scrolltop(); if(!ismobile){ if( st > 1 ){ $('.header').addclass('sheader'); }else{ $('.header').removeclass('sheader'); } } }; changeheader(); function changepnav(){ var st = $(window).scrolltop(); if(!ismobile&&$('.pvpos').size()!=0){ if( st > $('.pvpos').offset().top - $('.pnav').height() ){ $('.pnav').addclass('spnav'); }else{ $('.pnav').removeclass('spnav'); } } }; changepnav(); $menubtn.bind(_click, function () { var w = $menubox.width(); if (navitem == 0) { $('.menublack').stop().fadein(600); $(this).addclass('active'); $menubox.show().stop(false,false).animate({right:0}); navitem = 1; } else { $('.menublack').stop().fadeout(600); $(this).removeclass('active'); $menubox.stop(false,false).animate({right:-w+"px"},function(){ $(this).hide(); }); navitem = 0; }; }); $('.menublack').bind(_click, function () { var w = $menubox.width(); $menubtn.removeclass('active'); $('.menublack').stop().fadeout(600); $menubox.stop(false,false).animate({right:-w+"px"},function(){ $(this).hide(); }); navitem = 0; }); $('.navmobile dd p a').click(function(e){ if($(this).parent().next('.mtnav').size() >= 1){ if(!$(this).hasclass('act')){ e.preventdefault(); $('.navmobile dd p a').removeclass('act'); $('.mtnav').stop().slideup(300); $(this).addclass('act'); $(this).parent().next('.mtnav').stop().slidedown(300); }else{ $(this).removeclass('act'); $(this).parent().next('.mtnav').stop().slideup(300); } } }); //weixin setpopup($('.weixin'), "官方微信"); function setpopup(obj, title) { obj.click(function () { var str = '
'; $("body").append(str); jquery(".popupblack").fadein(); jquery(".popup").animate({margintop:"-127"},400); $(".popup .close").click(function () { $(".popupblack").remove(); }); jquery(".popupblack").click(function(){$(".popupblack").remove();}); return false; }); }; function setscroll(anchorcur){ if(jquery(anchorcur).length>=1){ jquery("html,body").animate({ scrolltop: jquery(anchorcur).offset().top-$mtoph}, 0); } }; window.onload = function () { var hash = location.href.split("#")[1]; if (hash) { setscroll("#" + hash); } }; }); $(document).on('click','.overlayclose',function(){ $('.imgshowbox').removeclass('img-show'); jquery('html').removeclass('openimg'); settimeout(function () { jquery('.imgshowbox').remove(); }, 800); }); function openshowimg(num,maxnum) { $('html').addclass('openimg'); jquery("body").append('
'); $(".imgstools .snumbox .actnum").html(num); $(".imgstools .snumbox .allnum").html(maxnum); for(var i = 1 ; i <= maxnum ; i++){ $('.imgshowdemo').append('
'); var imgurl = $("[data-big-num="+i+"]").attr('data-img'); var imgtitle = $("[data-big-num="+i+"]").attr('data-title'); $('.imgshowdemo .item').eq(i-1).find(".img").attr("src",imgurl); $('.imgshowdemo .item').eq(i-1).find('.i').html(imgtitle); } $(".imgshowbox").css({ height: w_height }); $('.imgshowdemo').css({ height: w_height,width: w_width }); $('.imgshowdemo .item').css({ height: w_height }); jquery(window).resize(function(){ $(".imgshowbox").css({ height: w_height }); $('.imgshowdemo').css({ height: w_height,width: w_width }); $('.imgshowdemo .item').css({ height: w_height }); }); var imgowl=$('.imgshowdemo').slick({fade:true,arrows:false}).on('beforechange', function(event, slick, currentslide, nextslide){ $(".imgstools .snumbox .actnum").html(nextslide+1); }); $('.imgstools .imgprev').click(function(e){ e.preventdefault(); imgowl.slick('slickprev'); }); $('.imgstools .imgnext').click(function(e){ e.preventdefault(); imgowl.slick('slicknext'); }); $('.imgshowdemo').slick('slickgoto',num-1); $('.imgshowbox').addclass('img-show'); }; function showmap(zuobiao, showmapinfo, zoom) { var arrzuobiao = zuobiao.split(','); var map = new bmap.map("map"); var point = new bmap.point(arrzuobiao[0], arrzuobiao[1]); var marker = new bmap.marker(point, { icon: new bmap.icon("images/mapi.png", new bmap.size(74, 74)) }) map.addoverlay(marker); //marker.setanimation(bmap_animation_bounce); map.centerandzoom(point, zoom); map.disablescrollwheelzoom(); var opts = { width: 240 } var infowindow = new bmap.infowindow(showmapinfo, opts); marker.addeventlistener("click", function () { map.openinfowindow(infowindow,point); }); }; var objplay; var video = { load: function (objs) { objplay = jwplayer(objs.vcontainer).setup({ flashplayer: 'js/video/flashplay.swf', html5player: 'js/video/html5player.js', file: objs.vfiles, image: objs.vfimg, width: '100%', height: '100%', aspectratio: '16:9', stretching: 'fill', controls: 'true', autostart: objs.isautoplay }); return objplay; } }; function setimgmax(img, imgw, imgh, tw, th) { var twidth = tw || w_width; var theight = th || w_height; var coe = imgh / imgw; var coe2 = theight / twidth; if (coe < coe2) { var imgwidth = theight / coe; img.css({ height: theight, width: imgwidth, left: -(imgwidth - twidth) / 2, top: 0 }); } else { var imgheight = twidth * coe; img.css({ height: imgheight, width: twidth, left: 0, top: -(imgheight - theight) / 2 }); } }; var isnum = 1, count_num1,count_num2,count_num3,count_num4,count_num5,a,b,c,d,e; function changenum(){ isnum = 0; var options = { useeasing : true, usegrouping : true, separator : '', decimal : '.', prefix : '', suffix : '' }; count_num1=$("#count_1").attr("data-num"); count_num2=$("#count_2").attr("data-num"); count_num3=$("#count_3").attr("data-num"); count_num4=$("#count_4").attr("data-num"); count_num5=$("#count_5").attr("data-num"); if(count_num1){a=new countup("count_1",0,count_num1,0,2.5,options);} if(count_num2){b=new countup("count_2",0,count_num2,0,2.5,options);} if(count_num3){c=new countup("count_3",0,count_num3,0,2.5,options);} if(count_num4){d=new countup("count_4",0,count_num4,0,2.5,options);} if(count_num5){e=new countup("count_5",0,count_num5,0,2.5,options);} }; function numstart(){ st = $(window).scrolltop(); if(isnum==0) { if(count_num1){a.start();} if(count_num2){b.start();} if(count_num3){c.start();} if(count_num4){d.start();} if(count_num5){e.start();} isnum = 1; }else{ return true; } };