/** * 全屏幻灯片类 */ function slideclass(dividname){ //幻灯节点对象 this.divobj=$("#"+dividname); //大图节点对象 this.divbigimgobj=$("#"+dividname+" .list"); this.bigliarr=$("#"+dividname+" .list li"); //缩略图节点对象 this.divobj.append("
"); this.divthumbobj=$("#"+dividname+" .thumb"); this.thumbliobj=null; //其他设置 this.index=this.divbigimgobj.length-1; this.timeer=null; this.speed=5000;//切换速度 } /** * 初始化 */ slideclass.prototype.init=function(n){ this.setbigmarginleft(); this.setbtn(); this.bindevt(); this.showone(); this.paly(); } /** * 设置大图距离左边的位置 */ slideclass.prototype.setbigmarginleft = function(){ var width = $(this.divbigimgobj).width(); for (var i = 0; i < this.bigliarr.length; i++) { this.setsize(this.bigliarr[i]); } } /*设置居中*/ slideclass.prototype.setsize=function(liobj) { var thewidht=parseint($(window).width(),10); var imgobj=$(liobj).find("img").get(0); var width=parseint($(imgobj).attr("oldw"),10); var height=parseint($(imgobj).attr("oldh"),10); //alert(height); var nowheight=parseint($(imgobj).height(),10); var nowwidht=parseint(width*nowheight/height,10); var left=parseint((thewidht-nowwidht)/2,10); //alert(thewidht); $(imgobj).css({"left":left+"px"}); } /** * 设置按钮 */ slideclass.prototype.setbtn = function(){ var width=parseint(24 * this.bigliarr.length, 10); var thehtml = "