Authored by 王水玲

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

... ... @@ -6,20 +6,19 @@
var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
tip = require('../plugin/tip'),
lazyLoad = require('yoho-jquery-lazyload'),
ellipsis = require('yoho-mlellipsis'),
loading = require('../plugin/loading'),
PullRefresh = require('../plugin/pull-refresh');
ellipsis = require('yoho-mlellipsis');
var $window = $(window),
$starMain = $('.star-main'),
$bannerTop = $('.banner-top'),
$starArticle = $('.star-article'),
$avatarWrap = $('.avatar-wrap'),
bannerLen = $('.avatar-wrap').find('.swiper-slide').length,
bannerLen = $avatarWrap.find('.swiper-slide').length,
avatarTop = parseInt($starMain.find('.avatar').css('margin-top')),
u = navigator.userAgent,
isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
/*
$swiperView = $('.swiper-view'),
$viewImg = $('.view-img'),
... ... @@ -92,6 +91,38 @@ function bindAvatar(dom) {
}
}
// 悬浮明星头像
function cloneAvatarInit() {
if ($window.scrollTop() >= $bannerTop.height() + avatarTop) {
$avatarClone.show();
if (!avatarSwiperClone) {
avatarSwiperClone = new Swiper('.avatar-0', {
loop: true,
initialSlide: $('.avatar-1').find('.swiper-slide-active').index() % bannerLen,
centeredSlides: true,
slidesPerView: 'auto',
loopedSlides: bannerLen,
spaceBetween: 10,
slidesOffsetBefore: -swiperNum,
watchSlidesProgress: true,
watchSlidesVisibility: true,
onInit: function() {
$('.avatar-0 li').on('click', function() {
res = bindAvatar($(this));
return res;
});
}
});
avatarSwiperClone.params.control = avatarSwiper;
avatarSwiper.params.control = avatarSwiperClone;
}
} else {
$avatarClone.hide();
}
}
// 初始化首页各种效果
function initAction() {
$starMain.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
... ... @@ -171,39 +202,6 @@ function initAction() {
cloneAvatarInit();
}
// 悬浮明星头像
function cloneAvatarInit() {
if ($window.scrollTop() >= $bannerTop.height() + parseInt($starMain.find('.avatar').css('margin-top'))) {
$avatarClone.show();
if (!avatarSwiperClone) {
avatarSwiperClone = new Swiper('.avatar-0', {
loop: true,
initialSlide: $('.avatar-1').find('.swiper-slide-active').index() % bannerLen,
centeredSlides: true,
slidesPerView: 'auto',
loopedSlides: bannerLen,
spaceBetween: 10,
slidesOffsetBefore: -swiperNum,
watchSlidesProgress: true,
watchSlidesVisibility: true,
onInit: function() {
$('.avatar-0 li').on('click', function() {
res = bindAvatar($(this));
return res;
});
}
});
avatarSwiperClone.params.control = avatarSwiper;
avatarSwiper.params.control = avatarSwiperClone;
}
} else {
$avatarClone.hide();
}
}
initAction();
$window.scroll(function() {
... ...
... ... @@ -418,7 +418,8 @@
.star-index-bg {
background: #000;
/*overflow: hidden;*/
/* overflow: hidden; */
.star-page {
background: #000;
... ...