Authored by 王水玲

星潮优化

... ... @@ -67,7 +67,7 @@ function scrollHandler() {
}
$(window).scroll(function() {
scrollHandler();
window.requestAnimationFrame(scrollHandler);
});
if ($('.collocation-list').find('li').length === 0) {
... ...
... ... @@ -68,7 +68,7 @@ function scrollHandler() {
}
$(window).scroll(function() {
scrollHandler();
window.requestAnimationFrame(scrollHandler);
});
if ($detailList.find('li').length === 0) {
... ...
... ... @@ -15,7 +15,9 @@ var $ = require('yoho-jquery'),
var $window = $(window),
stopLoading = false,
$starMain = $('.star-main'),
$headTab = $('.head-tab');
$headTab = $('.head-tab'),
headTabH = $headTab.height(),
scrollH = $(window).height() - headTabH;
/*
$swiperView = $('.swiper-view'),
... ... @@ -27,7 +29,7 @@ var $window = $(window),
var mySwiper;
*/
var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, $avatarClone, $avatar, $starArticle;
var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, $avatarClone, $starArticle;
var swiperNum = ($('.swiper-num2').width() - $('.swiper-num1').width()) +
($('.swiper-num3').width() - $('.swiper-num1').width()) / 2;
... ... @@ -74,11 +76,11 @@ function bindAvatar(dom) {
if (!dom.hasClass('swiper-slide-active')) {
if (avatarKey >= (2 * bannerLen + 1)) {
avatarSwiperClone && avatarSwiperClone.slideTo(bannerLen + 1, 200);
avatarSwiper.slideTo(bannerLen + 1, 200);
avatarSwiperClone && avatarSwiperClone.slideTo(bannerLen + 1, 0);
avatarSwiper.slideTo(bannerLen + 1, 0);
} else if (avatarKey <= (bannerLen - 1)) {
avatarSwiperClone && avatarSwiperClone.slideTo(2 * bannerLen - 1, 200);
avatarSwiper.slideTo(2 * bannerLen - (bannerLen - avatarKey), 200);
avatarSwiperClone && avatarSwiperClone.slideTo(2 * bannerLen - 1, 0);
avatarSwiper.slideTo(2 * bannerLen - (bannerLen - avatarKey), 0);
} else {
avatarSwiperClone && avatarSwiperClone.slideTo(avatarKey, 200);
avatarSwiper.slideTo(avatarKey, 200);
... ... @@ -96,7 +98,7 @@ function setIndexAction() {
// 下拉刷新,上拉加载
starIScroll = new PullRefresh('.star-wrap', {
height: $(window).height() - $headTab.height(),
height: scrollH,
pullDown: function() {
if (!stopLoading) {
stopLoading = true;
... ... @@ -118,7 +120,7 @@ function setIndexAction() {
});
starIScroll.iScroll.on('scroll', function() {
if ($avatarWrap.offset().top <= $headTab.height()) {
if ($avatarWrap.offset().top <= headTabH) {
$avatarClone.show();
if (!avatarSwiperClone) {
... ... @@ -231,9 +233,8 @@ function setIndexAction() {
}
function initAction() {
$avatar = $('.avatar');
$starArticle = $('.star-article');
bannerLen = $avatar.find('.swiper-slide').length;
bannerLen = $('.avatar-wrap').find('.swiper-slide').length;
if ($avatarClone) {
$avatarClone.remove();
... ... @@ -250,9 +251,7 @@ function initAction() {
lazyLoad($('img.lazy'));
setTimeout(function() {
setIndexAction();
}, 100);
setIndexAction();
}
... ...