...
|
...
|
@@ -9,11 +9,38 @@ var $ = require('yoho-jquery'), |
|
|
lazyLoad = require('yoho-jquery-lazyload'),
|
|
|
ellipsis = require('yoho-mlellipsis');
|
|
|
|
|
|
var avatarSwiper, avatarKey, $this, $title, $cont;
|
|
|
var $starArticle = $('.star-article');
|
|
|
|
|
|
var avatarSwiper, avatarKey;
|
|
|
|
|
|
lazyLoad($('img.lazy'));
|
|
|
ellipsis.init();
|
|
|
|
|
|
// 限制标题字数
|
|
|
function txtLimit(dom) {
|
|
|
var $title = dom.find('.article-title'),
|
|
|
$cont = dom.find('p');
|
|
|
|
|
|
$title[0].mlellipsis(2);
|
|
|
$cont[0].mlellipsis(3);
|
|
|
}
|
|
|
|
|
|
// 明星动态文章图片相关操作
|
|
|
function articleImgAction(dom) {
|
|
|
var $articeImgs = dom.find('.artice-imgs'),
|
|
|
$li = $articeImgs.find('li'),
|
|
|
imgLen = $articeImgs.find('img').length,
|
|
|
addFlagDom = $li.eq(2);
|
|
|
|
|
|
$li.on('click', function() {
|
|
|
console.log('1');
|
|
|
});
|
|
|
|
|
|
if (imgLen > 3 && addFlagDom.find('.img-size').length < 1) {
|
|
|
addFlagDom.append('<div class="img-size"><i class="pic-icon"></i>' + imgLen + '</div>');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if ($('.banner-swiper .swiper-slide').length > 1) {
|
|
|
new Swiper('.banner-swiper', {
|
|
|
lazyLoading: true,
|
...
|
...
|
@@ -41,26 +68,22 @@ if ($('.avatar-swiper .swiper-slide').length > 1) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
if ($('.star-info').find('li').length > 0) {
|
|
|
// 限制标题字数
|
|
|
$('.star-article').each(function() {
|
|
|
$this = $(this);
|
|
|
$title = $this.find('.article-title');
|
|
|
$cont = $this.find('p');
|
|
|
|
|
|
$title[0].mlellipsis(2);
|
|
|
$cont[0].mlellipsis(3);
|
|
|
$starArticle.each(function(key, item) {
|
|
|
txtLimit($(item));
|
|
|
articleImgAction($(item));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$('body').addClass('star-index-bg');
|
|
|
|
|
|
$('.avatar-swiper li').not('.swiper-slide-active').on('click', function() {
|
|
|
avatarKey = $(this).index();
|
|
|
avatarSwiper.slideTo(avatarKey, 1000, false);
|
|
|
});
|
|
|
|
|
|
$('.swiper-slide-active').on('click', function() {
|
|
|
location.href = $(this).find('img').data('url');
|
|
|
// 明星头像点击居中显示或跳转
|
|
|
$('.avatar-swiper li').on('click', function() {
|
|
|
if ($(this).hasClass('swiper-slide-active')) {
|
|
|
location.href = $(this).find('img').data('url');
|
|
|
} else {
|
|
|
avatarKey = $(this).index();
|
|
|
avatarSwiper.slideTo(avatarKey, 1000, false);
|
|
|
}
|
|
|
}); |
...
|
...
|
|