先上核心js
(function ($) {
$.fn.myScroll = function (options) {
//默认配置
let defaults = {
speed: 40, //滚动速度,值越大速度越慢
// rowHeight: 38, //每行的高度
line: 6,
};
let opts = $.extend({
}, defaults, options),
intId = null;
function marquee(obj) {
let rowHeight=obj.find("ul:first").height()/opts["line"]
obj.find("ul").animate({
marginTop: '-=1'
}, 0, function () {
let s = Math.abs(parseInt($(