function scrollView(id, interval, direction) { var box = document.getElementById(id); var can = true; var fq = fq || 10; interval = interval || 1500; direction = direction === -1 ? -1 : 1; box.innerHTML += box.innerHTML; box.onmouseover = function() { can = false; }; box.onmouseout = function() { can = true; }; var max = parseInt(box.scrollHeight / 2); (function() { var stop = box.scrollTop % 45 === 0 && !can; if (!stop) { var set = direction > 0 ? [max, 0] : [0, max]; box.scrollTop === set[0] ? (box.scrollTop = set[1]) : (box.scrollTop += direction); } setTimeout(arguments.callee, box.scrollTop % 45 ? fq : interval); }()); } scrollView("slide1",1000);
跑马灯上下
最新推荐文章于 2021-06-07 14:39:12 发布