|
@@ -64,11 +64,13 @@ function setAvatar($userAvatar) { |
|
@@ -64,11 +64,13 @@ function setAvatar($userAvatar) { |
64
|
|
64
|
|
65
|
function setIndexAction() {
|
65
|
function setIndexAction() {
|
66
|
var starIScroll;
|
66
|
var starIScroll;
|
|
|
67
|
+ var commonHeaderTop = $('#yoho-header').outerHeight();
|
67
|
var $loadingTip = $('.loading-tip');
|
68
|
var $loadingTip = $('.loading-tip');
|
|
|
69
|
+ var $avatarWrap = $('.avatar-wrap');
|
68
|
|
70
|
|
69
|
// 下拉刷新,上拉加载
|
71
|
// 下拉刷新,上拉加载
|
70
|
starIScroll = new PullRefresh('.star-wrap', {
|
72
|
starIScroll = new PullRefresh('.star-wrap', {
|
71
|
- height: $(window).height() - $('#yoho-header').height() - $('.head-tab').height(),
|
73
|
+ height: $(window).height() - commonHeaderTop,
|
72
|
pullDown: function() {
|
74
|
pullDown: function() {
|
73
|
if (!stopLoading) {
|
75
|
if (!stopLoading) {
|
74
|
stopLoading = true;
|
76
|
stopLoading = true;
|
|
@@ -86,8 +88,13 @@ function setIndexAction() { |
|
@@ -86,8 +88,13 @@ function setIndexAction() { |
86
|
});
|
88
|
});
|
87
|
|
89
|
|
88
|
starIScroll.iScroll.on('scroll', function() {
|
90
|
starIScroll.iScroll.on('scroll', function() {
|
89
|
- if (this.startY < -180) {
|
|
|
90
|
- console.log('111');
|
91
|
+ if (commonHeaderTop > $avatarWrap.offset().top) {
|
|
|
92
|
+ // $('.avatar-clone').css('top', $('.head-tab').outerHeight());
|
|
|
93
|
+ $('.avatar-clone').show();
|
|
|
94
|
+ starIScroll[0].update();
|
|
|
95
|
+ starIScroll[1].update();
|
|
|
96
|
+ } else {
|
|
|
97
|
+ $('.avatar-clone').hide();
|
91
|
}
|
98
|
}
|
92
|
});
|
99
|
});
|
93
|
|
100
|
|
|
@@ -190,7 +197,7 @@ function setIndexAction() { |
|
@@ -190,7 +197,7 @@ function setIndexAction() { |
190
|
// }
|
197
|
// }
|
191
|
|
198
|
|
192
|
if (bannerLen > 1) {
|
199
|
if (bannerLen > 1) {
|
193
|
- avatarSwiper[0] = new Swiper('.avatar-0', {
|
200
|
+ avatarSwiper = new Swiper('.avatar', {
|
194
|
loop: true,
|
201
|
loop: true,
|
195
|
|
202
|
|
196
|
// loopedSlides: bannerLen,
|
203
|
// loopedSlides: bannerLen,
|
|
@@ -198,12 +205,15 @@ function setIndexAction() { |
|
@@ -198,12 +205,15 @@ function setIndexAction() { |
198
|
centeredSlides: true,
|
205
|
centeredSlides: true,
|
199
|
slidesPerView: 'auto',
|
206
|
slidesPerView: 'auto',
|
200
|
spaceBetween: 10,
|
207
|
spaceBetween: 10,
|
201
|
- slidesOffsetBefore: '-' + $('.avatar-0').find('li').not('.swiper-slide-visible').width() / 2,
|
208
|
+ slidesOffsetBefore: -($('.avatar').find('li').not('.swiper-slide-visible').width() / 2),
|
202
|
watchSlidesProgress: true,
|
209
|
watchSlidesProgress: true,
|
203
|
watchSlidesVisibility: true,
|
210
|
watchSlidesVisibility: true,
|
204
|
observer: true,
|
211
|
observer: true,
|
205
|
observeParents: true
|
212
|
observeParents: true
|
206
|
});
|
213
|
});
|
|
|
214
|
+
|
|
|
215
|
+ avatarSwiper[0].params.control = avatarSwiper[1];// 需要在Swiper2初始化后,Swiper1控制Swiper2
|
|
|
216
|
+ avatarSwiper[1].params.control = avatarSwiper[0];// 需要在Swiper1初始化后,Swiper2控制Swiper1
|
207
|
}
|
217
|
}
|
208
|
|
218
|
|
209
|
// 明星动态头像左右滑动
|
219
|
// 明星动态头像左右滑动
|
|
@@ -247,6 +257,8 @@ function setIndexAction() { |
|
@@ -247,6 +257,8 @@ function setIndexAction() { |
247
|
}
|
257
|
}
|
248
|
|
258
|
|
249
|
getIndexHtml = function() {
|
259
|
getIndexHtml = function() {
|
|
|
260
|
+ var $starMain = $('.star-main');
|
|
|
261
|
+
|
250
|
loading.showLoadingMask();
|
262
|
loading.showLoadingMask();
|
251
|
$.ajax({
|
263
|
$.ajax({
|
252
|
url: '/guang/star/getIndexHtml',
|
264
|
url: '/guang/star/getIndexHtml',
|
|
@@ -254,14 +266,15 @@ getIndexHtml = function() { |
|
@@ -254,14 +266,15 @@ getIndexHtml = function() { |
254
|
success: function(data) {
|
266
|
success: function(data) {
|
255
|
stopLoading = false;
|
267
|
stopLoading = false;
|
256
|
|
268
|
|
257
|
- console.log(data);
|
|
|
258
|
-
|
|
|
259
|
if (!data) {
|
269
|
if (!data) {
|
260
|
stopLoading = true;
|
270
|
stopLoading = true;
|
261
|
tip.show('没有更多内容了');
|
271
|
tip.show('没有更多内容了');
|
262
|
}
|
272
|
}
|
263
|
|
273
|
|
264
|
- $('.star-main').html(data);
|
274
|
+ $starMain.html(data);
|
|
|
275
|
+ bannerLen = $('.avatar .swiper-slide').length;
|
|
|
276
|
+
|
|
|
277
|
+ $starMain.prepend($('.avatar-swiper').clone().addClass('avatar-clone').hide());
|
265
|
|
278
|
|
266
|
// 限制标题字数
|
279
|
// 限制标题字数
|
267
|
$('.cont-area').each(function() {
|
280
|
$('.cont-area').each(function() {
|
|
@@ -270,7 +283,6 @@ getIndexHtml = function() { |
|
@@ -270,7 +283,6 @@ getIndexHtml = function() { |
270
|
|
283
|
|
271
|
loading.hideLoadingMask();
|
284
|
loading.hideLoadingMask();
|
272
|
lazyLoad($('img.lazy'));
|
285
|
lazyLoad($('img.lazy'));
|
273
|
- bannerLen = $('.avatar-0 .swiper-slide').length;
|
|
|
274
|
|
286
|
|
275
|
setTimeout(function() {
|
287
|
setTimeout(function() {
|
276
|
setIndexAction();
|
288
|
setIndexAction();
|