Home > Article > Web Front-end > jQuery implements automatic scrolling of lists to display news in a loop_jquery
News (announcements, events, pictures, etc.) need to be displayed in a circular scrolling manner in a small area on the page, and the scrolling should stop and prompt when the mouse is hovering, and the scrolling should continue after leaving.
Rendering:
Here’s the dry stuff
html:
function scrollNews(obj) {
var $self = obj.find("ul");
var lineHeight = $self.find("li:first").height();
$self.animate({
"marginTop": -lineHeight "px"
}, 600, function() {
$self.css({
marginTop: 0
}).find("li:first").appendTo($self);
})
}
})