|
@@ -6,6 +6,8 @@ |
|
@@ -6,6 +6,8 @@ |
6
|
|
6
|
|
7
|
var $ = require('yoho-jquery'),
|
7
|
var $ = require('yoho-jquery'),
|
8
|
Swiper = require('yoho-swiper'),
|
8
|
Swiper = require('yoho-swiper'),
|
|
|
9
|
+
|
|
|
10
|
+ // inView = require('in-view'),
|
9
|
loading = require('../plugin/loading'),
|
11
|
loading = require('../plugin/loading'),
|
10
|
PullRefresh = require('../plugin/pull-refresh');
|
12
|
PullRefresh = require('../plugin/pull-refresh');
|
11
|
|
13
|
|
|
@@ -31,6 +33,12 @@ var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, ba |
|
@@ -31,6 +33,12 @@ var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, ba |
31
|
|
33
|
|
32
|
var swiperNum = $('.avatar-wrap .swiper-slide').width() / 2;
|
34
|
var swiperNum = $('.avatar-wrap .swiper-slide').width() / 2;
|
33
|
|
35
|
|
|
|
36
|
+// var $gif = $('img[data-original*="gif"]');
|
|
|
37
|
+
|
|
|
38
|
+if ($('.star-main').css('height') === '0px') {
|
|
|
39
|
+ $('.star-main').css('height', $window.height() - $('.head-tab').height());
|
|
|
40
|
+}
|
|
|
41
|
+
|
34
|
if ($window.width() === 375 && isiOS) {
|
42
|
if ($window.width() === 375 && isiOS) {
|
35
|
swiperNum = 32;
|
43
|
swiperNum = 32;
|
36
|
}
|
44
|
}
|
|
@@ -38,11 +46,29 @@ if ($window.width() === 375 && isiOS) { |
|
@@ -38,11 +46,29 @@ if ($window.width() === 375 && isiOS) { |
38
|
require('../common');
|
46
|
require('../common');
|
39
|
require('yoho-jquery-lazyload');
|
47
|
require('yoho-jquery-lazyload');
|
40
|
|
48
|
|
|
|
49
|
+// require('yoho-jquery-inview');
|
|
|
50
|
+
|
41
|
$window.on('mousewheel', false);
|
51
|
$window.on('mousewheel', false);
|
42
|
$('#yoho-header, .head-tab').on('touchmove', function() {
|
52
|
$('#yoho-header, .head-tab').on('touchmove', function() {
|
43
|
return false;
|
53
|
return false;
|
44
|
});
|
54
|
});
|
45
|
|
55
|
|
|
|
56
|
+// inView(document.querySelectorAll('img[data-original*="gif"]'))
|
|
|
57
|
+// .on('enter', function() {
|
|
|
58
|
+// console.log(1);
|
|
|
59
|
+// })
|
|
|
60
|
+// .on('exit', function() {
|
|
|
61
|
+// console.log(2);
|
|
|
62
|
+// });
|
|
|
63
|
+
|
|
|
64
|
+// $('img[data-original*="gif"]').on('inview', function(event, isInView) {
|
|
|
65
|
+// if (isInView) {
|
|
|
66
|
+// $(this).css('display', 'block');
|
|
|
67
|
+// } else {
|
|
|
68
|
+// $(this).css('display', 'none');
|
|
|
69
|
+// }
|
|
|
70
|
+// });
|
|
|
71
|
+
|
46
|
// 限制标题字数
|
72
|
// 限制标题字数
|
47
|
// function txtLimit() {
|
73
|
// function txtLimit() {
|
48
|
//
|
74
|
//
|
|
@@ -95,7 +121,6 @@ function setIndexAction() { |
|
@@ -95,7 +121,6 @@ function setIndexAction() { |
95
|
|
121
|
|
96
|
// 明星头像 swiper 初始化
|
122
|
// 明星头像 swiper 初始化
|
97
|
if (bannerLen > 1) {
|
123
|
if (bannerLen > 1) {
|
98
|
- console.log(Math.floor($avatarWrap.find('.swiper-slide').length / 2));
|
|
|
99
|
avatarSwiper = new Swiper($avatarWrap.find('.avatar-swiper')[0], {
|
124
|
avatarSwiper = new Swiper($avatarWrap.find('.avatar-swiper')[0], {
|
100
|
lazyLoading: true,
|
125
|
lazyLoading: true,
|
101
|
lazyLoadingInPrevNextAmount: 3,
|
126
|
lazyLoadingInPrevNextAmount: 3,
|
|
@@ -183,6 +208,7 @@ getIndexHtml = function() { |
|
@@ -183,6 +208,7 @@ getIndexHtml = function() { |
183
|
$.ajax({
|
208
|
$.ajax({
|
184
|
url: '/guang/star/getIndexHtml',
|
209
|
url: '/guang/star/getIndexHtml',
|
185
|
dataType: 'html',
|
210
|
dataType: 'html',
|
|
|
211
|
+ timeout: 5000
|
186
|
})
|
212
|
})
|
187
|
.done(function(data) {
|
213
|
.done(function(data) {
|
188
|
if (data) {
|
214
|
if (data) {
|
|
@@ -217,54 +243,57 @@ starIScroll.iScroll.on('scrollStart', function() { |
|
@@ -217,54 +243,57 @@ starIScroll.iScroll.on('scrollStart', function() { |
217
|
// if (this.directionY === -1) {
|
243
|
// if (this.directionY === -1) {
|
218
|
// $loadingTip.slideDown();
|
244
|
// $loadingTip.slideDown();
|
219
|
// }
|
245
|
// }
|
220
|
-
|
246
|
+ // $gif.css('display', 'none');
|
221
|
bannerSwiper && bannerSwiper.startAutoplay();
|
247
|
bannerSwiper && bannerSwiper.startAutoplay();
|
222
|
});
|
248
|
});
|
223
|
|
249
|
|
224
|
-// starIScroll.iScroll.on('scroll', function() {
|
|
|
225
|
-// var avatarOffsetT;
|
|
|
226
|
-//
|
|
|
227
|
-// if (this.directionY !== -1) {
|
|
|
228
|
-// setTimeout(function() {
|
|
|
229
|
-// starIScroll.iScroll.refresh();
|
|
|
230
|
-// }, 0);
|
|
|
231
|
-// }
|
|
|
232
|
-//
|
|
|
233
|
-// avatarOffsetT = $avatarWrap[0].offsetTop;
|
|
|
234
|
-//
|
|
|
235
|
-// if (-this.y >= avatarOffsetT) {
|
|
|
236
|
-// $avatarClone.show();
|
|
|
237
|
-//
|
|
|
238
|
-// if (!avatarSwiperClone) {
|
|
|
239
|
-// avatarSwiperClone = new Swiper($avatarClone[0], {
|
|
|
240
|
-// loop: true,
|
|
|
241
|
-// initialSlide: $avatarWrap.find('.swiper-slide-active').index() % bannerLen,
|
|
|
242
|
-// centeredSlides: true,
|
|
|
243
|
-// slidesPerView: 'auto',
|
|
|
244
|
-// loopedSlides: bannerLen,
|
|
|
245
|
-// spaceBetween: 10,
|
|
|
246
|
-// slidesOffsetBefore: -swiperNum,
|
|
|
247
|
-// watchSlidesProgress: true,
|
|
|
248
|
-// watchSlidesVisibility: true,
|
|
|
249
|
-// onInit: function() {
|
|
|
250
|
-// $avatarClone.find('li').on('click', function() {
|
|
|
251
|
-// res = bindAvatar($(this));
|
|
|
252
|
-// return res;
|
|
|
253
|
-// });
|
|
|
254
|
-// }
|
|
|
255
|
-// });
|
|
|
256
|
-//
|
|
|
257
|
-// avatarSwiperClone.params.control = avatarSwiper;
|
|
|
258
|
-// avatarSwiper.params.control = avatarSwiperClone;
|
|
|
259
|
-// }
|
|
|
260
|
-// } else {
|
|
|
261
|
-// $avatarClone.hide();
|
|
|
262
|
-// }
|
|
|
263
|
-// });
|
250
|
+starIScroll.iScroll.on('scroll', function() {
|
|
|
251
|
+ // var avatarOffsetT;
|
|
|
252
|
+ //
|
|
|
253
|
+ // if (this.directionY !== -1) {
|
|
|
254
|
+ // setTimeout(function() {
|
|
|
255
|
+ // starIScroll.iScroll.refresh();
|
|
|
256
|
+ // }, 0);
|
|
|
257
|
+ // }
|
|
|
258
|
+ //
|
|
|
259
|
+ // avatarOffsetT = $avatarWrap[0].offsetTop;
|
|
|
260
|
+ //
|
|
|
261
|
+ // if (-this.y >= avatarOffsetT) {
|
|
|
262
|
+ // $avatarClone.show();
|
|
|
263
|
+ //
|
|
|
264
|
+ // if (!avatarSwiperClone) {
|
|
|
265
|
+ // avatarSwiperClone = new Swiper($avatarClone[0], {
|
|
|
266
|
+ // lazyLoading: true,
|
|
|
267
|
+ // lazyLoadingInPrevNext: true,
|
|
|
268
|
+ //
|
|
|
269
|
+ // // loop: true,
|
|
|
270
|
+ // initialSlide: $avatarWrap.find('.swiper-slide-active').index() % bannerLen,
|
|
|
271
|
+ // centeredSlides: true,
|
|
|
272
|
+ // slidesPerView: 'auto',
|
|
|
273
|
+ // loopedSlides: bannerLen,
|
|
|
274
|
+ // spaceBetween: 10,
|
|
|
275
|
+ // slidesOffsetBefore: -swiperNum,
|
|
|
276
|
+ // watchSlidesProgress: true,
|
|
|
277
|
+ // watchSlidesVisibility: true,
|
|
|
278
|
+ // onInit: function() {
|
|
|
279
|
+ // $avatarClone.find('li').on('click', function() {
|
|
|
280
|
+ // res = bindAvatar($(this));
|
|
|
281
|
+ // return res;
|
|
|
282
|
+ // });
|
|
|
283
|
+ // }
|
|
|
284
|
+ // });
|
|
|
285
|
+ //
|
|
|
286
|
+ // avatarSwiperClone.params.control = avatarSwiper;
|
|
|
287
|
+ // avatarSwiper.params.control = avatarSwiperClone;
|
|
|
288
|
+ // }
|
|
|
289
|
+ // } else {
|
|
|
290
|
+ // $avatarClone.hide();
|
|
|
291
|
+ // }
|
|
|
292
|
+});
|
264
|
|
293
|
|
265
|
starIScroll.iScroll.on('scrollEnd', function() {
|
294
|
starIScroll.iScroll.on('scrollEnd', function() {
|
266
|
// $loadingTip.slideUp();
|
295
|
// $loadingTip.slideUp();
|
267
|
-
|
296
|
+ // $gif.css('display', 'block');
|
268
|
bannerSwiper && bannerSwiper.stopAutoplay();
|
297
|
bannerSwiper && bannerSwiper.stopAutoplay();
|
269
|
});
|
298
|
});
|
270
|
|
299
|
|