|
@@ -14,14 +14,10 @@ var $ = require('yoho-jquery'), |
|
@@ -14,14 +14,10 @@ var $ = require('yoho-jquery'), |
14
|
|
14
|
|
15
|
var $window = $(window),
|
15
|
var $window = $(window),
|
16
|
$starArticle = $('.star-article'),
|
16
|
$starArticle = $('.star-article'),
|
17
|
-
|
|
|
18
|
- // $headTab = $('.head-tab'),
|
|
|
19
|
- stopLoading = false,
|
|
|
20
|
- avatarSwiper,
|
|
|
21
|
- avatarSwiperClone,
|
|
|
22
|
- getIndexHtml;
|
17
|
+ stopLoading = false;
|
23
|
|
18
|
|
24
|
/*
|
19
|
/*
|
|
|
20
|
+ $headTab = $('.head-tab'),
|
25
|
$swiperView = $('.swiper-view'),
|
21
|
$swiperView = $('.swiper-view'),
|
26
|
$viewImg = $('.view-img'),
|
22
|
$viewImg = $('.view-img'),
|
27
|
$body = $('body'),
|
23
|
$body = $('body'),
|
|
@@ -31,7 +27,7 @@ var $window = $(window), |
|
@@ -31,7 +27,7 @@ var $window = $(window), |
31
|
var mySwiper;
|
27
|
var mySwiper;
|
32
|
*/
|
28
|
*/
|
33
|
|
29
|
|
34
|
-var avatarKey, bannerLen, res;
|
30
|
+var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, $avatarClone, $avatar;
|
35
|
|
31
|
|
36
|
require('../common');
|
32
|
require('../common');
|
37
|
|
33
|
|
|
@@ -124,7 +120,7 @@ function setIndexAction() { |
|
@@ -124,7 +120,7 @@ function setIndexAction() { |
124
|
|
120
|
|
125
|
starIScroll.iScroll.on('scroll', function() {
|
121
|
starIScroll.iScroll.on('scroll', function() {
|
126
|
if ($avatarWrap.offset().top <= 0) {
|
122
|
if ($avatarWrap.offset().top <= 0) {
|
127
|
- $('.avatar-clone').show();
|
123
|
+ $avatarClone.show();
|
128
|
|
124
|
|
129
|
if (!avatarSwiperClone) {
|
125
|
if (!avatarSwiperClone) {
|
130
|
avatarSwiperClone = new Swiper('.avatar-0', {
|
126
|
avatarSwiperClone = new Swiper('.avatar-0', {
|
|
@@ -151,7 +147,7 @@ function setIndexAction() { |
|
@@ -151,7 +147,7 @@ function setIndexAction() { |
151
|
}
|
147
|
}
|
152
|
|
148
|
|
153
|
if ($avatarWrap.offset().top > $('.avatar-1')[0].scrollHeight) {
|
149
|
if ($avatarWrap.offset().top > $('.avatar-1')[0].scrollHeight) {
|
154
|
- $('.avatar-clone').hide();
|
150
|
+ $avatarClone.hide();
|
155
|
}
|
151
|
}
|
156
|
});
|
152
|
});
|
157
|
|
153
|
|
|
@@ -164,63 +160,6 @@ function setIndexAction() { |
|
@@ -164,63 +160,6 @@ function setIndexAction() { |
164
|
$loadingTip.slideUp();
|
160
|
$loadingTip.slideUp();
|
165
|
});
|
161
|
});
|
166
|
|
162
|
|
167
|
- // 明星动态文章图片相关操作
|
|
|
168
|
- /*
|
|
|
169
|
- function articleImgAction(dom, key) {
|
|
|
170
|
- var $articeImgs = dom.find('.artice-imgs'),
|
|
|
171
|
- $li = $articeImgs.find('li'),
|
|
|
172
|
- imgLen = $articeImgs.find('img').length,
|
|
|
173
|
- addFlagDom = $li.eq(2);
|
|
|
174
|
-
|
|
|
175
|
- var i;
|
|
|
176
|
-
|
|
|
177
|
- imgs = [];
|
|
|
178
|
-
|
|
|
179
|
- $li.each(function() {
|
|
|
180
|
- imgs.push($(this).find('img').attr('src'));
|
|
|
181
|
- });
|
|
|
182
|
-
|
|
|
183
|
- allImgs[key] = imgs;
|
|
|
184
|
-
|
|
|
185
|
- $li.on('click', function() {
|
|
|
186
|
- for (i = 0; i < imgLen; i++) {
|
|
|
187
|
- $swiperView.find('ul').append('<li class="swiper-slide">' +
|
|
|
188
|
- '<img class="swiper-lazy" data-src="' + allImgs[key][i] + '">' +
|
|
|
189
|
- '<div class="swiper-lazy-preloader"></div></li>');
|
|
|
190
|
- }
|
|
|
191
|
- setTimeout(function() {
|
|
|
192
|
- mySwiper = new Swiper('.swiper-view', {
|
|
|
193
|
- lazyLoading: true,
|
|
|
194
|
- lazyLoadingInPrevNext: true,
|
|
|
195
|
- slideElement: 'li'
|
|
|
196
|
- });
|
|
|
197
|
-
|
|
|
198
|
- $('.swiper-view li').on('click', function(e) {
|
|
|
199
|
- if (e.target.nodeName === 'IMG') {
|
|
|
200
|
- return;
|
|
|
201
|
- }
|
|
|
202
|
- $viewImg.hide();
|
|
|
203
|
- $body.css({
|
|
|
204
|
- overflow: 'auto'
|
|
|
205
|
- });
|
|
|
206
|
- $viewImg.find('li').remove();
|
|
|
207
|
- mySwiper.destroy(false);
|
|
|
208
|
- });
|
|
|
209
|
- }, 100);
|
|
|
210
|
-
|
|
|
211
|
- $viewImg.show();
|
|
|
212
|
-
|
|
|
213
|
- $body.css({
|
|
|
214
|
- overflow: 'hidden'
|
|
|
215
|
- });
|
|
|
216
|
- });
|
|
|
217
|
-
|
|
|
218
|
- if (imgLen > 3 && addFlagDom.find('.img-size').length < 1) {
|
|
|
219
|
- addFlagDom.append('<div class="img-size"><i class="pic-icon"></i>' + imgLen + '</div>');
|
|
|
220
|
- }
|
|
|
221
|
- }
|
|
|
222
|
- */
|
|
|
223
|
-
|
|
|
224
|
$('.avatar').each(function(key, item) {
|
163
|
$('.avatar').each(function(key, item) {
|
225
|
$(item).addClass('avatar-' + key);
|
164
|
$(item).addClass('avatar-' + key);
|
226
|
});
|
165
|
});
|
|
@@ -307,10 +246,11 @@ getIndexHtml = function() { |
|
@@ -307,10 +246,11 @@ getIndexHtml = function() { |
307
|
}
|
246
|
}
|
308
|
|
247
|
|
309
|
$starMain.html(data);
|
248
|
$starMain.html(data);
|
310
|
- bannerLen = $('.avatar .swiper-slide').length;
|
249
|
+ $avatar = $('.avatar');
|
|
|
250
|
+ bannerLen = $avatar.find('.swiper-slide').length;
|
311
|
|
251
|
|
312
|
- if ($('.avatar-clone').length) {
|
|
|
313
|
- $('.avatar-clone').remove();
|
252
|
+ if ($avatarClone) {
|
|
|
253
|
+ $avatarClone.remove();
|
314
|
}
|
254
|
}
|
315
|
|
255
|
|
316
|
$('.avatar li').each(function() {
|
256
|
$('.avatar li').each(function() {
|
|
@@ -319,6 +259,8 @@ getIndexHtml = function() { |
|
@@ -319,6 +259,8 @@ getIndexHtml = function() { |
319
|
|
259
|
|
320
|
$starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
|
260
|
$starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
|
321
|
|
261
|
|
|
|
262
|
+ $avatarClone = $('.avatar-clone');
|
|
|
263
|
+
|
322
|
// 限制标题字数
|
264
|
// 限制标题字数
|
323
|
$('.cont-area').each(function() {
|
265
|
$('.cont-area').each(function() {
|
324
|
txtLimit($(this), '.title', '.cont-txt');
|
266
|
txtLimit($(this), '.title', '.cont-txt');
|
|
@@ -339,3 +281,60 @@ getIndexHtml = function() { |
|
@@ -339,3 +281,60 @@ getIndexHtml = function() { |
339
|
};
|
281
|
};
|
340
|
|
282
|
|
341
|
getIndexHtml();
|
283
|
getIndexHtml();
|
|
|
284
|
+
|
|
|
285
|
+// 明星动态文章图片相关操作
|
|
|
286
|
+/*
|
|
|
287
|
+function articleImgAction(dom, key) {
|
|
|
288
|
+ var $articeImgs = dom.find('.artice-imgs'),
|
|
|
289
|
+ $li = $articeImgs.find('li'),
|
|
|
290
|
+ imgLen = $articeImgs.find('img').length,
|
|
|
291
|
+ addFlagDom = $li.eq(2);
|
|
|
292
|
+
|
|
|
293
|
+ var i;
|
|
|
294
|
+
|
|
|
295
|
+ imgs = [];
|
|
|
296
|
+
|
|
|
297
|
+ $li.each(function() {
|
|
|
298
|
+ imgs.push($(this).find('img').attr('src'));
|
|
|
299
|
+ });
|
|
|
300
|
+
|
|
|
301
|
+ allImgs[key] = imgs;
|
|
|
302
|
+
|
|
|
303
|
+ $li.on('click', function() {
|
|
|
304
|
+ for (i = 0; i < imgLen; i++) {
|
|
|
305
|
+ $swiperView.find('ul').append('<li class="swiper-slide">' +
|
|
|
306
|
+ '<img class="swiper-lazy" data-src="' + allImgs[key][i] + '">' +
|
|
|
307
|
+ '<div class="swiper-lazy-preloader"></div></li>');
|
|
|
308
|
+ }
|
|
|
309
|
+ setTimeout(function() {
|
|
|
310
|
+ mySwiper = new Swiper('.swiper-view', {
|
|
|
311
|
+ lazyLoading: true,
|
|
|
312
|
+ lazyLoadingInPrevNext: true,
|
|
|
313
|
+ slideElement: 'li'
|
|
|
314
|
+ });
|
|
|
315
|
+
|
|
|
316
|
+ $('.swiper-view li').on('click', function(e) {
|
|
|
317
|
+ if (e.target.nodeName === 'IMG') {
|
|
|
318
|
+ return;
|
|
|
319
|
+ }
|
|
|
320
|
+ $viewImg.hide();
|
|
|
321
|
+ $body.css({
|
|
|
322
|
+ overflow: 'auto'
|
|
|
323
|
+ });
|
|
|
324
|
+ $viewImg.find('li').remove();
|
|
|
325
|
+ mySwiper.destroy(false);
|
|
|
326
|
+ });
|
|
|
327
|
+ }, 100);
|
|
|
328
|
+
|
|
|
329
|
+ $viewImg.show();
|
|
|
330
|
+
|
|
|
331
|
+ $body.css({
|
|
|
332
|
+ overflow: 'hidden'
|
|
|
333
|
+ });
|
|
|
334
|
+ });
|
|
|
335
|
+
|
|
|
336
|
+ if (imgLen > 3 && addFlagDom.find('.img-size').length < 1) {
|
|
|
337
|
+ addFlagDom.append('<div class="img-size"><i class="pic-icon"></i>' + imgLen + '</div>');
|
|
|
338
|
+ }
|
|
|
339
|
+}
|
|
|
340
|
+*/ |