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 <= 769) { ismobile = true; } else if (w_width > 769) { ismobile = false; }; }; 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, 2000,595); bannersider.flexslider({ slideshowspeed: 6000, animationspeed: 1200, directionnav:true, pauseonaction: false, animation: "slide", keyboardnav: true, }); }else{ setimgmax($bannerimg, 480,380); bannersider.flexslider({ animation: "slide", slideshowspeed: 6000, animationspeed: 1200, directionnav:true, pauseonaction: false, }); } }; initbox(); $(window).resize(function () { initbox(); }); });