var istouch = modernizr.touchevents, ismobile = false, w_width = $(window).width(), w_height = $(window).height(); var _mousemove; var _click; var _mousedown; var _mouseup; if (modernizr.touchevents) { _mousemove = "touchmove"; _click = "touchend"; _mousedown = "touchstart"; _mouseup = "touchend"; } else { _mousemove = "mousemove"; _click = "click"; _mousedown = "mousedown"; _mouseup = "mouseup"; }; function pagebox() { w_width = $(window).width(); w_height = $(window).height(); if (w_width <= 768) { ismobile = true; } else if (w_width > 768) { ismobile = false; $('.pbanner .pimg').css('transform', "translate(0px,0px)"); }; }; pagebox(); $(window).resize(function () { pagebox(); }); function setimgmax(img, imgw, imgh) { var bheight=0, $banner = $('.banner'), $bannerpic = $banner.find(".pic"), $bannerimg = $banner.find(".pimg"), bannersider=$(".bannerbox"); var coe = imgh / imgw; img.css({ height: w_width*coe, width: w_width, top: 0 }); $banner.css({ height:w_width*coe}); $bannerpic.css({ height: w_width*coe}); }; $(function(){ var bheight=0, $banner = $('.banner'), $bannerpic = $banner.find(".pic"), $bannerimg = $banner.find(".pimg"), bannersider=$(".bannerbox"); function initbox() { if (!ismobile){ setimgmax($bannerimg, 1920,736); }else{ setimgmax($bannerimg, 480,380); } if(!ismobile){ bannersider.flexslider({ slideshowspeed: 5000, animationspeed: 1200, directionnav:true, pauseonaction: false, keyboardnav: true, // start:function(){ // $(".bannerbox .pic .binbox").hide().css({left:"55%",opacity:"hide"}); // $(".bannerbox .flex-active-slide .binbox").stop(false,false).delay(50).animate({left:"50%",opacity:"show"},600); // }, // before: function() { // $(".bannerbox .pic .binbox").hide().css({left:"55%",opacity:"hide"}); // }, // after: function() { // $(".bannerbox .flex-active-slide .binbox").stop(false,false).delay(50).animate({left:"50%",opacity:"show"},600); // } }); }else{ bannersider.flexslider({ animation: "slide", slideshowspeed: 5000, animationspeed: 1200, directionnav:true, pauseonaction: false, // start:function(){ // $(".bannerbox .pic .binbox").hide().css({left:"55%",opacity:"hide"}); // $(".bannerbox .flex-active-slide .binbox").stop(false,false).delay(50).animate({left:"50%",opacity:"show"},600); // }, // before: function() { // $(".bannerbox .pic .binbox").hide().css({left:"55%",opacity:"hide"}); // }, // after: function() { // $(".bannerbox .flex-active-slide .binbox").stop(false,false).delay(50).animate({left:"50%",opacity:"show"},600); // } }); } }; initbox(); $(window).resize(function () { initbox(); }); }); // 首页产品切换 function settab(name,cursel){ for(var i= 1; i<= 5; i++){ var menu = document.getelementbyid(name+i); var menudiv = document.getelementbyid("con_"+name+"_"+i); if(i==cursel){ menu.parentnode.classname="active"; menudiv.style.display="block"; } else{ menu.parentnode.classname=""; menudiv.style.display="none"; } } }