...
|
...
|
@@ -7,16 +7,19 @@ |
|
|
var $ = require('jquery'),
|
|
|
Hammer = require('yoho.hammer'),
|
|
|
ellipsis = require('mlellipsis'),
|
|
|
lazyLoad = require('yoho.lazyload');
|
|
|
lazyLoad = require('yoho.lazyload'),
|
|
|
Swiper = require('yoho.iswiper');
|
|
|
|
|
|
var tip = require('../plugin/tip');
|
|
|
var loading = require('../plugin/loading');
|
|
|
|
|
|
var $loadMoreInfo = $('#load-more-info');
|
|
|
var $loading = $(''),
|
|
|
$noMore = $('');
|
|
|
$noMore = $(''),
|
|
|
$swiper = $('');
|
|
|
|
|
|
var searching = false;
|
|
|
var mySwiper = {};
|
|
|
|
|
|
ellipsis.init();
|
|
|
|
...
|
...
|
@@ -25,6 +28,19 @@ if ($loadMoreInfo.length > 0) { |
|
|
$noMore = $loadMoreInfo.children('.no-more');
|
|
|
}
|
|
|
|
|
|
//初始化swiper
|
|
|
function initSwiper(typeId) {
|
|
|
if (typeof typeId === undefined) {
|
|
|
return;
|
|
|
}
|
|
|
mySwiper[typeId] = new Swiper('.swiper-cont-' + typeId, {
|
|
|
lazyLoading: true,
|
|
|
wrapperClass: 'swiper-wrap-' + typeId,
|
|
|
pagination: '.swiper-pagi-' + typeId,
|
|
|
autoplay: 3000
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置指定资讯项的Lazyload和文字截取
|
|
|
* @params $infos 资讯项
|
...
|
...
|
@@ -175,6 +191,14 @@ function loadMore($container, opt, url) { |
|
|
|
|
|
$container.append(data);
|
|
|
|
|
|
$swiper = $container.find('.swiper-container');
|
|
|
if ($swiper.length) {
|
|
|
$swiper.addClass('swiper-cont-' + opt.type);
|
|
|
$swiper.children('.swiper-wrapper').addClass('swiper-wrap-' + opt.type);
|
|
|
$swiper.children('.swiper-pagination').addClass('swiper-pagi-' + opt.type);
|
|
|
initSwiper(opt.type);
|
|
|
}
|
|
|
|
|
|
if (num > 0) {
|
|
|
$newItems = $container.find('.guang-info:gt(' + (num - 1) + ')');
|
|
|
} else {
|
...
|
...
|
@@ -194,14 +218,19 @@ function loadMore($container, opt, url) { |
|
|
opt.page++;
|
|
|
|
|
|
searching = false;
|
|
|
delete opt.isTab;
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
searching = false;
|
|
|
delete opt.isTab;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
exports.mySwiper = mySwiper;
|
|
|
exports.initSwiper = initSwiper;
|
|
|
exports.initInfosEvt = initInfosEvt;
|
|
|
exports.setLazyLoadAndMellipsis = setLazyLoadAndMellipsis;
|
|
|
exports.loadMore = loadMore; |
|
|
\ No newline at end of file |
...
|
...
|
|