<script>
$ (function () {
Single-line Application
var _wrap=$ (' Ul.line ');//define scrolling area
var _interval=2000;//defines the rolling gap time
var _moving;//animations that need to be cleared
_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 is not placed at the beginning of the function, the Li:first value is changed
var _h=_field.height ();//Get each scroll height
_field.animate ({margintop:-_h+ ' px '},600,function () {//) hides the first row by taking a negative margin value
_field.css (' margintop ', 0). AppendTo (_wrap);//After hiding, the margin value of the line is zeroed and inserted into the end, enabling seamless scrolling
})
},_interval)//scrolling interval depends on _interval
}). Trigger (' MouseLeave ');//When the function is loaded, the simulation executes the mouseleave, i.e. auto-scroll
});
$ (function () {
Multi-line applications
var _wrap=$ (' Ul.mulitline ');//define scrolling area
var _interval=3000;//defines the rolling gap time
var _moving;//animations that need to be cleared
_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 is not placed at the beginning of the function, the Li:first value is changed
var _h=_field.height ();//Get each scroll height
_field.animate ({margintop:-_h+ ' px '},600,function () {//) hides the first row by taking a negative margin value
_field.css (' margintop ', 0). AppendTo (_wrap);//After hiding, the margin value of the line is zeroed and inserted into the end, enabling seamless scrolling
})
},_interval)//scrolling interval depends on _interval
}). Trigger (' MouseLeave ');//When the function is loaded, the simulation executes the mouseleave, i.e. auto-scroll
});
</script>
jquery-based up and down seamless scrolling application (single or multiple lines)