jquery achieved by the following text to cycle through the example code

<div ID = " oDiv " > 
<UL ID = " Oul " > 
<li> 1 li element </ li> 
<li> 2 li element </ li> 
<li> 3 li element </ li> 
<li> 4 li element </ li> 
<li> 5 li element </ li> 
<li> 6 li element </ li> 
<li> 7 li element </ li> 
<li> li element 8 </ li> 
</ UL> 
</ div>

But the page only the first five li (related css not go into details), you want to cycle li inside the content is to move the height of ul li upward in the development of time, the same time added to the first li ul li in the end.
  code show as below:

function autoScroll(obj, ul_bz){
$(obj).find(ul_bz).animate({
marginTop : "-25px"
},500,function(){
$(this).css({marginTop : "0px"}).find("li:first").appendTo(this);
});
}
setInterval('autoScroll("#oDiv", "#oUl")',3000)

 

Guess you like

Origin www.cnblogs.com/SofuBlue/p/11315977.html