效果
JS代码
initScrollBox: function () {
var speed = [100, 100, 100, 100];
var boxes = $('.boxscrolls');
var me = this;
boxes.each(function (i) {
var box = $(this);
var table = $(this).find("tbody").first();
if (table.height() > box.height()) {
$(this).find(".tablescroll0").html(table.html());
var h1 = box.scrollTop(), h2 = table.innerHeight();
function Marquee() {
if (me.scrollFlag) {
if (h1 >= h2) {
box.scrollTop(0);
h1 = box.scrollTop();
} else {
box.scrollTop(++h1);
}
}
}
me.timer = setInterval(Marquee, speed[i]);
//鼠标悬停 离开
box.mouseover(fun