<body><div id="title" style="width:100%;height:40px;"> Look at the intermittent scrolling text </div><div id="content" class="infocontent"><div id="top" class="infolist"><ul><li> CCTV 315 exposure : China resources deeply "sea sand door" response clear and not clear </li><li> Yoshino home was exposed tableware is not disinfected Bosideng and other cashmere sweaters do not contain cashmere </li><li> Wuxi police announced that "pregnant female police sudden misfortune" after the incident </li><li> Chinese day: the last ferry Horizon: "done at home" </li></ul></div><div id="bottom" class="infolist"></div></div><div id="foot"></div></body>
.infolist{width:400px;matgin:0;}.infolist ul{margin:0;padding:0;}.infolist ul li{list-style:none;height:26px;line-height:26px;}.infocontent{width:400px;height:26px;overflow:hidden;border:1px solid #666666;}
var interval=1000;//The time interval between the two rollsvar stepsize=26;//The length of a roll must be a multiple of the height of the row, so as not to break the linevar objInterval=null;$(document).ready( function(){//Fill the bottom with the contents of the top$("#bottom").html($("#top").html());//Binds mouse events to the displayed area$("#content").bind("mouseover",function(){StopScroll();});$("#content").bind("mouseout",function(){StartScroll();});//Start timerStartScroll();});//Start the timer and start rollingfunction StartScroll(){objInterval=setInterval("verticalloop()",interval);}//Clear the timer and stop scrollingfunction StopScroll(){window.clearInterval(objInterval);}//Control rollingfunction verticalloop(){//Determine whether the upper contents are all moved out of the display area//If so, start over. Otherwise, keep moving upif($("#content").scrollTop()>=$("#top").outerHeight()){$("#content").scrollTop($("#content").scrollTop()-$("#top").outerHeight());}//Use jquery to create scrolling animations$("#content").animate({"scrollTop" : $("#content").scrollTop()+stepsize +"px"},600,function(){//Here is the scrollTop used to display the scroll area, please delete it in practice// $("#foot").html("scrollTop:"+$("#content").scrollTop());});}