cloneHtmlNow += cloneHtmlStart;
}
obj.append(cloneHtmlNow);
liTotalSizeOther = (cloneCount + 1) * liTotalSize; //获取添加了子元素之后的长度
})();
if (opt.dir == “left” || opt.dir == “right”) {
obj.css({ “position”: “relative”, “z-index”: 0 });
obj.children().css({ “position”: “absolute”, “z-index”: 1 });
var left = 0;
obj.children().each(function () {
$(this).css({ “left”: left + “px”, “top”: 0 });
left += $(this).outerWidth(true);
});
}
//滚动条的滚动方法
function scrollChange(dir) {
if (dir == “left” || dir == “up”) {
obj[scrollEvent](0);
scrollChange = function () {
scrollSize++;
if (scrollSize >= liTotalSize) scrollSize = 0;
obj[scrollEvent](scrollSize);
}
}
else if (dir == “right” || dir == “down”) {
scrollSizeMax = liTotalSizeOther – objSize;
obj[scrollEvent](scrollSizeMax);
scrollSize = scrollSizeMax;
scrollSizeMin = scrollSizeMax – liTotalSize;
scrollChange = function () {
scrollSize–;
if (scrollSize <= scrollSizeMin) scrollSize = scrollSizeMax;
obj[scrollEvent](scrollSize);
}
}
};
scrollChange(opt.dir);
interval = setInterval(scrollChange, opt.delay);
obj.children().on(“mouseover”, function () {
clearInterval(interval);
}).on(“mouseleave”, function () {
interval = setInterval(scrollChange, opt.delay);
});
}
})(jQuery);
插件的调用:
$(function () {
$(“#guoul1”).gysContentDisplay({ dir: “right” });
$(“#guoul2”).gysContentDisplay({ dir: “left” });
$(“#guoul3”).gysContentDisplay({ dir: “up” });
$(“#guoul4”).gysContentDisplay({ dir: “down” });
$(“#guoul5”).gysContentDisplay({ dir: “right” });
$(“#guoul6”).gysContentDisplay({ dir: “none” });
})










