Authored by 王水玲

星潮教室优化,去除下拉刷新

@@ -6,20 +6,19 @@ @@ -6,20 +6,19 @@
6 6
7 var $ = require('yoho-jquery'), 7 var $ = require('yoho-jquery'),
8 Swiper = require('yoho-swiper'), 8 Swiper = require('yoho-swiper'),
9 - tip = require('../plugin/tip'),  
10 lazyLoad = require('yoho-jquery-lazyload'), 9 lazyLoad = require('yoho-jquery-lazyload'),
11 - ellipsis = require('yoho-mlellipsis'),  
12 - loading = require('../plugin/loading'),  
13 - PullRefresh = require('../plugin/pull-refresh'); 10 + ellipsis = require('yoho-mlellipsis');
14 11
15 var $window = $(window), 12 var $window = $(window),
16 $starMain = $('.star-main'), 13 $starMain = $('.star-main'),
17 $bannerTop = $('.banner-top'), 14 $bannerTop = $('.banner-top'),
18 $starArticle = $('.star-article'), 15 $starArticle = $('.star-article'),
19 $avatarWrap = $('.avatar-wrap'), 16 $avatarWrap = $('.avatar-wrap'),
20 - bannerLen = $('.avatar-wrap').find('.swiper-slide').length, 17 + bannerLen = $avatarWrap.find('.swiper-slide').length,
  18 + avatarTop = parseInt($starMain.find('.avatar').css('margin-top')),
21 u = navigator.userAgent, 19 u = navigator.userAgent,
22 isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); 20 isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  21 +
23 /* 22 /*
24 $swiperView = $('.swiper-view'), 23 $swiperView = $('.swiper-view'),
25 $viewImg = $('.view-img'), 24 $viewImg = $('.view-img'),
@@ -92,6 +91,38 @@ function bindAvatar(dom) { @@ -92,6 +91,38 @@ function bindAvatar(dom) {
92 } 91 }
93 } 92 }
94 93
  94 +// 悬浮明星头像
  95 +function cloneAvatarInit() {
  96 + if ($window.scrollTop() >= $bannerTop.height() + avatarTop) {
  97 + $avatarClone.show();
  98 +
  99 + if (!avatarSwiperClone) {
  100 + avatarSwiperClone = new Swiper('.avatar-0', {
  101 + loop: true,
  102 + initialSlide: $('.avatar-1').find('.swiper-slide-active').index() % bannerLen,
  103 + centeredSlides: true,
  104 + slidesPerView: 'auto',
  105 + loopedSlides: bannerLen,
  106 + spaceBetween: 10,
  107 + slidesOffsetBefore: -swiperNum,
  108 + watchSlidesProgress: true,
  109 + watchSlidesVisibility: true,
  110 + onInit: function() {
  111 + $('.avatar-0 li').on('click', function() {
  112 + res = bindAvatar($(this));
  113 + return res;
  114 + });
  115 + }
  116 + });
  117 +
  118 + avatarSwiperClone.params.control = avatarSwiper;
  119 + avatarSwiper.params.control = avatarSwiperClone;
  120 + }
  121 + } else {
  122 + $avatarClone.hide();
  123 + }
  124 +}
  125 +
95 // 初始化首页各种效果 126 // 初始化首页各种效果
96 function initAction() { 127 function initAction() {
97 $starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide()); 128 $starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
@@ -171,39 +202,6 @@ function initAction() { @@ -171,39 +202,6 @@ function initAction() {
171 cloneAvatarInit(); 202 cloneAvatarInit();
172 } 203 }
173 204
174 -// 悬浮明星头像  
175 -function cloneAvatarInit() {  
176 - if ($window.scrollTop() >= $bannerTop.height() + parseInt($starMain.find('.avatar').css('margin-top'))) {  
177 - $avatarClone.show();  
178 -  
179 - if (!avatarSwiperClone) {  
180 - avatarSwiperClone = new Swiper('.avatar-0', {  
181 - loop: true,  
182 - initialSlide: $('.avatar-1').find('.swiper-slide-active').index() % bannerLen,  
183 - centeredSlides: true,  
184 - slidesPerView: 'auto',  
185 - loopedSlides: bannerLen,  
186 - spaceBetween: 10,  
187 - slidesOffsetBefore: -swiperNum,  
188 - watchSlidesProgress: true,  
189 - watchSlidesVisibility: true,  
190 - onInit: function() {  
191 - $('.avatar-0 li').on('click', function() {  
192 - res = bindAvatar($(this));  
193 - return res;  
194 - });  
195 - }  
196 - });  
197 -  
198 - avatarSwiperClone.params.control = avatarSwiper;  
199 - avatarSwiper.params.control = avatarSwiperClone;  
200 - }  
201 - } else {  
202 - $avatarClone.hide();  
203 - }  
204 -}  
205 -  
206 -  
207 initAction(); 205 initAction();
208 206
209 $window.scroll(function() { 207 $window.scroll(function() {
@@ -418,7 +418,8 @@ @@ -418,7 +418,8 @@
418 418
419 .star-index-bg { 419 .star-index-bg {
420 background: #000; 420 background: #000;
421 - /*overflow: hidden;*/ 421 +
  422 + /* overflow: hidden; */
422 423
423 .star-page { 424 .star-page {
424 background: #000; 425 background: #000;