notice-scroll.js
607 Bytes
/**
* 公告栏目滚动
* bikai kai.bi@yoho.cn
*/
var $ = require('yoho-jquery');
function noticeScroll(selecter, time) {
var $notice = $(selecter),
$noticeItem = $notice.find('.notice-item'),
count = $noticeItem.length,
i = 1;
selecter = selecter || '.notice';
time = time || 3000;
if (count > 1) {
setInterval(function() {
if (i >= count) {
i = 0;
}
$noticeItem.fadeOut();
$notice.find('.item-' + i).fadeIn();
i++;
}, time);
}
}
module.exports = noticeScroll;