$(function(){ var win_width = 0; var win_height = 0; var obanner = $(".banner"); init(); main(); function init(){ win_width = $(window).width(); win_height = $(window).height(); setimgmax(obanner.find("li .img"),1440,674); if(win_width<=1050-17){ obanner.css({height:win_height-50}); }else{ obanner.css({height:win_height-132}); } } function main(){ $(".scrolltip,.tip2").click(function(){ $("html,body").animate({ scrolltop:$(window).height()},500); return false; }); obanner.pztouch({ imglistclass : "ul",//被移动的框 imgsclass : "li",//每一项 outbox : $(window),//父级宽度基于此外框 btnleft : $(".banner .btnleft"),//左右切换按钮 btnright : $(".banner .btnright"), btns : $(".banner .btns"), btnstype : "span", btnsevent : "mouseover", autoplay : true,//自动播放开关 autospeed : 5000,//自动播放间隔时间 firstfunc : null,//初始化执行一次 resizefunc : null,//改变窗口时执行 endfunc : null }); $(".newsbox").pztouch({ imglistclass : "ul",//被移动的框 imgsclass : "li",//每一项 outbox : $(".newsbox"),//父级宽度基于此外框 btns : $(".hotnews .btns"),//按钮父级 btnstype : "span",//按钮类型 btnsevent : "mouseover",//按钮事件 autoplay : false,//自动播放开关 autospeed : 5000,//自动播放间隔时间 firstfunc : null,//初始化执行一次 resizefunc : null,//改变窗口时执行 endfunc : null,//滑动结束回调 ind : 0//初始索引 }); } function setimgmax(img,imgw,imgh,tw,th){ //设置图片宽高比例 var twidth = tw||win_width; var theight = th||win_height; var coe = imgh/imgw; var coe2 = theight/twidth; if(coe