文字向上滚动分为:无缝滚动、间歇性滚动
间歇性滚动
使用jQuery的 animate
一般情况下,向上翻滚一行内容,即一个<li></li>
,但是如果是一行有多个li
标签,要使用常见的插件就会出现问题了…
所以自己改吧改吧:
(function ($) {
$.fn.myScroll = function(options) {
var init = {
items: 1, //一行有几项内容
speed: 3000, //滚动速度
moveHeight: 22 // 行高
};
var intId = [];
var opts = $.extend({
}, init, options);
function moveUp(obj) {
obj.animate({
marginTop: '-' + opts.moveHeight + 'px'
},
1000,
function() {
var $this = $(this);
$this.find('li').slice(0, opts.items).appendTo($this);
$this.css('margin-top', 0);
})
}
this.each(function(i) {
var sh = opts.moveHeight,
speed = opts.speed,
items = opts.items,
$this = $(this);
intId[i] &