...
|
...
|
@@ -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,20 @@ if ($loadMoreInfo.length > 0) { |
|
|
$noMore = $loadMoreInfo.children('.no-more');
|
|
|
}
|
|
|
|
|
|
//初始化swiper
|
|
|
function initSwiper(typeId) {
|
|
|
console.log(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 +192,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 {
|
...
|
...
|
@@ -202,6 +227,9 @@ function loadMore($container, opt, url) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
exports.mySwiper = mySwiper;
|
|
|
exports.initSwiper = initSwiper;
|
|
|
exports.initInfosEvt = initInfosEvt;
|
|
|
exports.setLazyLoadAndMellipsis = setLazyLoadAndMellipsis;
|
|
|
exports.loadMore = loadMore; |
|
|
\ No newline at end of file |
...
|
...
|
|