autoLine:1, // 自动滚动的行数
speed:0, // 动作时间
interval:3000, // 滚动间隔
imgPath:””, // 图片根目录
directBtn:”img/direct_btn02.png”, // 指向图片
picTimer:0, // 间隔句柄,不需要设置,只是作为标识使用
opacity:0.3 // 按钮透明度
};
//参数初始化
var opts = $.extend(this.defaults,opt);
// 定义外层元素样式
$(“#”+opts.objId).css({
“position”:”relative”,
“overflow”:”hidden”,
“width”:(opts.line * opts.width) + “px”
});
// 定义ul样式
$(“#”+opts.objId + ” ul”).css({
“width”:opts.width * $(“#”+opts.objId + ” ul”).find(“li”).size() + “px”,
“height”:opts.height + “px”
});
// 定义li样式
$(“#”+opts.objId + ” ul li”).css({
“display”:”block”,
“float”:”left”,
“width”:opts.width + “px”,
“height”:opts.height + “px”
});
// 添加向左滚动按钮
$(“#”+opts.objId).append(“<div id=”button_left”></div>”);
// 定义向左按钮的位置
$(“#button_left”).css({
“width”:”40px”,
“height”:”40px”,
“background”:”url(” + opts.imgPath + opts.directBtn + “)”,
“background-position”:”0px 0px”,
“position”:”absolute”,
“left”:”0px”,
“top”:(opts.height/2 – 20) + “px”
});
// 添加向右滚动按钮
$(“#”+opts.objId).append(“<div id=”button_right”></div>”);
// 定义向右按钮的位置
$(“#button_right”).css({
“width”:”40px”,
“height”:”40px”,
“background”:”url(” + opts.imgPath + opts.directBtn + “)”,
“background-position”:”-40px 0px”,
“position”:”absolute”,
“left”:(opts.line * opts.width – 40) + “px”,
“top”:(opts.height/2 – 20) + “px”
});
// 向左按钮添加动作
$(“#button_left”).click(function(){
var scrollWidth = 0 – opts.line * opts.width – (0 – $(“#”+opts.objId).find(“ul:first”).css(“margin-left”).replace(“px”,””));
// 无间断滚动
$(“#”+opts.objId).find(“ul:first”).animate({
marginLeft:scrollWidth
},opts.speed,function(){
for(i=1;i<=opts.line;i++){
$(“#”+opts.objId).find(“li:first”).appendTo($(“#”+opts.objId).find(“ul:first”));










