以下代码jquery实现简单的滚动,原理是克隆第一个li然后放到末尾,接着让它往上滑动然后清除掉,反复循环
<script type="text/javascript">
function slide(ClassName){
var ID = setInterval ("run('"+ClassName+"')",1000);
$('.'+ClassName).mouseover(function(){
clearInterval(ID)
}).mouseout(function(){
ID = setInterval ("run('"+ClassName+"')",1000);
});
}
function run(ClassName){
$('.'+ClassName).find('li').first().clone().appendTo('.'+ClassName);
$('.'+ClassName).find('li').first().slideUp("slow",
function(){
$('.'+ClassName).find('li').first().remove();
}
);
}
$(function(){
slide('side-news-cnt');
});
</script>