...
|
...
|
@@ -14,14 +14,10 @@ var $ = require('yoho-jquery'), |
|
|
|
|
|
var $window = $(window),
|
|
|
$starArticle = $('.star-article'),
|
|
|
|
|
|
// $headTab = $('.head-tab'),
|
|
|
stopLoading = false,
|
|
|
avatarSwiper,
|
|
|
avatarSwiperClone,
|
|
|
getIndexHtml;
|
|
|
stopLoading = false;
|
|
|
|
|
|
/*
|
|
|
$headTab = $('.head-tab'),
|
|
|
$swiperView = $('.swiper-view'),
|
|
|
$viewImg = $('.view-img'),
|
|
|
$body = $('body'),
|
...
|
...
|
@@ -31,7 +27,7 @@ var $window = $(window), |
|
|
var mySwiper;
|
|
|
*/
|
|
|
|
|
|
var avatarKey, bannerLen, res;
|
|
|
var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, $avatarClone, $avatar;
|
|
|
|
|
|
require('../common');
|
|
|
|
...
|
...
|
@@ -124,7 +120,7 @@ function setIndexAction() { |
|
|
|
|
|
starIScroll.iScroll.on('scroll', function() {
|
|
|
if ($avatarWrap.offset().top <= 0) {
|
|
|
$('.avatar-clone').show();
|
|
|
$avatarClone.show();
|
|
|
|
|
|
if (!avatarSwiperClone) {
|
|
|
avatarSwiperClone = new Swiper('.avatar-0', {
|
...
|
...
|
@@ -151,7 +147,7 @@ function setIndexAction() { |
|
|
}
|
|
|
|
|
|
if ($avatarWrap.offset().top > $('.avatar-1')[0].scrollHeight) {
|
|
|
$('.avatar-clone').hide();
|
|
|
$avatarClone.hide();
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -164,63 +160,6 @@ function setIndexAction() { |
|
|
$loadingTip.slideUp();
|
|
|
});
|
|
|
|
|
|
// 明星动态文章图片相关操作
|
|
|
/*
|
|
|
function articleImgAction(dom, key) {
|
|
|
var $articeImgs = dom.find('.artice-imgs'),
|
|
|
$li = $articeImgs.find('li'),
|
|
|
imgLen = $articeImgs.find('img').length,
|
|
|
addFlagDom = $li.eq(2);
|
|
|
|
|
|
var i;
|
|
|
|
|
|
imgs = [];
|
|
|
|
|
|
$li.each(function() {
|
|
|
imgs.push($(this).find('img').attr('src'));
|
|
|
});
|
|
|
|
|
|
allImgs[key] = imgs;
|
|
|
|
|
|
$li.on('click', function() {
|
|
|
for (i = 0; i < imgLen; i++) {
|
|
|
$swiperView.find('ul').append('<li class="swiper-slide">' +
|
|
|
'<img class="swiper-lazy" data-src="' + allImgs[key][i] + '">' +
|
|
|
'<div class="swiper-lazy-preloader"></div></li>');
|
|
|
}
|
|
|
setTimeout(function() {
|
|
|
mySwiper = new Swiper('.swiper-view', {
|
|
|
lazyLoading: true,
|
|
|
lazyLoadingInPrevNext: true,
|
|
|
slideElement: 'li'
|
|
|
});
|
|
|
|
|
|
$('.swiper-view li').on('click', function(e) {
|
|
|
if (e.target.nodeName === 'IMG') {
|
|
|
return;
|
|
|
}
|
|
|
$viewImg.hide();
|
|
|
$body.css({
|
|
|
overflow: 'auto'
|
|
|
});
|
|
|
$viewImg.find('li').remove();
|
|
|
mySwiper.destroy(false);
|
|
|
});
|
|
|
}, 100);
|
|
|
|
|
|
$viewImg.show();
|
|
|
|
|
|
$body.css({
|
|
|
overflow: 'hidden'
|
|
|
});
|
|
|
});
|
|
|
|
|
|
if (imgLen > 3 && addFlagDom.find('.img-size').length < 1) {
|
|
|
addFlagDom.append('<div class="img-size"><i class="pic-icon"></i>' + imgLen + '</div>');
|
|
|
}
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
$('.avatar').each(function(key, item) {
|
|
|
$(item).addClass('avatar-' + key);
|
|
|
});
|
...
|
...
|
@@ -307,10 +246,11 @@ getIndexHtml = function() { |
|
|
}
|
|
|
|
|
|
$starMain.html(data);
|
|
|
bannerLen = $('.avatar .swiper-slide').length;
|
|
|
$avatar = $('.avatar');
|
|
|
bannerLen = $avatar.find('.swiper-slide').length;
|
|
|
|
|
|
if ($('.avatar-clone').length) {
|
|
|
$('.avatar-clone').remove();
|
|
|
if ($avatarClone) {
|
|
|
$avatarClone.remove();
|
|
|
}
|
|
|
|
|
|
$('.avatar li').each(function() {
|
...
|
...
|
@@ -319,6 +259,8 @@ getIndexHtml = function() { |
|
|
|
|
|
$starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
|
|
|
|
|
|
$avatarClone = $('.avatar-clone');
|
|
|
|
|
|
// 限制标题字数
|
|
|
$('.cont-area').each(function() {
|
|
|
txtLimit($(this), '.title', '.cont-txt');
|
...
|
...
|
@@ -339,3 +281,60 @@ getIndexHtml = function() { |
|
|
};
|
|
|
|
|
|
getIndexHtml();
|
|
|
|
|
|
// 明星动态文章图片相关操作
|
|
|
/*
|
|
|
function articleImgAction(dom, key) {
|
|
|
var $articeImgs = dom.find('.artice-imgs'),
|
|
|
$li = $articeImgs.find('li'),
|
|
|
imgLen = $articeImgs.find('img').length,
|
|
|
addFlagDom = $li.eq(2);
|
|
|
|
|
|
var i;
|
|
|
|
|
|
imgs = [];
|
|
|
|
|
|
$li.each(function() {
|
|
|
imgs.push($(this).find('img').attr('src'));
|
|
|
});
|
|
|
|
|
|
allImgs[key] = imgs;
|
|
|
|
|
|
$li.on('click', function() {
|
|
|
for (i = 0; i < imgLen; i++) {
|
|
|
$swiperView.find('ul').append('<li class="swiper-slide">' +
|
|
|
'<img class="swiper-lazy" data-src="' + allImgs[key][i] + '">' +
|
|
|
'<div class="swiper-lazy-preloader"></div></li>');
|
|
|
}
|
|
|
setTimeout(function() {
|
|
|
mySwiper = new Swiper('.swiper-view', {
|
|
|
lazyLoading: true,
|
|
|
lazyLoadingInPrevNext: true,
|
|
|
slideElement: 'li'
|
|
|
});
|
|
|
|
|
|
$('.swiper-view li').on('click', function(e) {
|
|
|
if (e.target.nodeName === 'IMG') {
|
|
|
return;
|
|
|
}
|
|
|
$viewImg.hide();
|
|
|
$body.css({
|
|
|
overflow: 'auto'
|
|
|
});
|
|
|
$viewImg.find('li').remove();
|
|
|
mySwiper.destroy(false);
|
|
|
});
|
|
|
}, 100);
|
|
|
|
|
|
$viewImg.show();
|
|
|
|
|
|
$body.css({
|
|
|
overflow: 'hidden'
|
|
|
});
|
|
|
});
|
|
|
|
|
|
if (imgLen > 3 && addFlagDom.find('.img-size').length < 1) {
|
|
|
addFlagDom.append('<div class="img-size"><i class="pic-icon"></i>' + imgLen + '</div>');
|
|
|
}
|
|
|
}
|
|
|
*/ |
...
|
...
|
|