$ (function () { var _wrap=$ (' Ul.line ');//define scrolling area VAR _interval=2000;//define rolling Gap time VAR _moving;//need to clear the animation _wrap.hover (function () { clearinterval (_moving) ;//When the mouse is in the scrolling area, stop scrolling },function () { _moving=setinterval (function () { var _field=_wrap.find (' Li:first ');//This variable cannot be placed at the beginning of the function, Li: The first value is the change var _h=_field.height ();//The variable cannot be placed at the beginning of each scroll height (multi-line scrolling) , otherwise there will be interval time delay) _field.animate ({margintop:-_h+ ' px '},600,function () {//By taking a negative margin value, hide the first line _field.css (' margintop ', 0). AppendTo (_wrap);//hide the margin value of the line and insert it into the end, to achieve seamless scrolling }) },_interval)//scrolling interval depends on _interval }). Trigger (' MouseleAve ');//When the function is loaded, the simulation executes mouseleave, i.e. automatic scrolling});
JQuery -based, up and down seamless scrolling application can be applied to multiple lines or single lines. Please refer to the comments for details.
View Demo:
Click here to view demo