往上滚动的JS
时间:2011-03-10 来源:放逐忧伤
$(function() {
var shtml = $("#scroll_ul")[0].innerHTML;
shtml += shtml;
$("#scroll_ul")[0].innerHTML = shtml;
var lisize = $("#scroll_ul li").size();
var linghight = parseInt($("#scroll_ul li:first").css("height"));
var num = 0;
var scrollinterval = setInterval(scrollul, 100);
$("#scroll_ul").hover(function() {
clearInterval(scrollinterval);
}, function() {
scrollinterval = setInterval(scrollul, 100);
})
function scrollul() {
if ((num / 10) < lisize / 2) {
num++;
$("#scroll_ul").css("marginTop", -parseInt((num * linghight) / 10) + "px");
}
else {
num = 0;
$("#scroll_ul").css("marginTop", "0px");
}
}
})
相关阅读 更多 +