1.html
<ul class="scroll_top" id="scroll_top">
<li>
<span class="hot">热门
<span>啦啦啦啦啦啦</span>
</li>
</ul>
2.js
function headline(data) {
var index =0;
var autoTimer =0;
var clickEndFlag =true;
var oInner =$(".scroll_top");
var oLi =$(".scroll_top li");
oLi.eq(0).clone(true).appendTo(oInner);
var liHeight =$(".advert").height();
function tab() {
oInner.stop().animate(
{
top: -index * liHeight
},
400,
function () {
clickEndFlag =true;
if (index == oLi.length) {
oInner.css({
top:0
});
index =0;
}
}
);
}
function next() {
index++;
tab();
}
autoTimer =setInterval(next, 3000);
$(".scroll_top li").hover(
function () {
clearInterval(autoTimer);
},
function () {
autoTimer =setInterval(next, 3000);
}
);
}
$(function () {
headline();
});