Authored by 王水玲

星潮教室首页明星头像效果

... ... @@ -14,12 +14,6 @@
<li class="swiper-slide">
<span class="rank-avatar" data-url="{{url}}" data-avatar="{{image cover 180 180}}"></span>
</li>
<li class="swiper-slide">
<span class="rank-avatar" data-url="{{url}}" data-avatar="{{image cover 180 180}}"></span>
</li>
<li class="swiper-slide">
<span class="rank-avatar" data-url="{{url}}" data-avatar="{{image cover 180 180}}"></span>
</li>
{{/ starAvatar}}
</ul>
</div>
... ...
... ... @@ -67,13 +67,17 @@ function setAvatar($userAvatar) {
function setIndexAction() {
var starIScroll;
var commonHeaderTop = $('#yoho-header').outerHeight();
var $loadingTip = $('.loading-tip');
var $avatarWrap = $('.avatar-wrap');
var commonHeaderTop = $('#yoho-header').outerHeight(),
$loadingTip = $('.loading-tip'),
$avatarWrap = $('.avatar-wrap'),
avatarHeight = $('.avatar').height(),
infoMTop = parseInt($('.star-info').css('marginTop'));
// 下拉刷新,上拉加载
starIScroll = new PullRefresh('.star-wrap', {
height: $(window).height() - commonHeaderTop,
height: $(window).height() - commonHeaderTop - avatarHeight - infoMTop * 2,
pullDown: function() {
if (!stopLoading) {
stopLoading = true;
... ... @@ -117,7 +121,7 @@ function setIndexAction() {
}
}
if (Math.abs(this.startY) < $('.banner-top').height() + $('.avatar').outerHeight() + $('.head-tab').height()) {
if (Math.abs(this.startY) < $('.banner-top').height() + avatarHeight + $('.head-tab').height()) {
$('.avatar-clone').hide();
}
});
... ... @@ -247,11 +251,16 @@ function setIndexAction() {
} else {
avatarKey = $(this).index();
if (avatarSwiperClone) {
avatarSwiperClone.slideTo(avatarKey, 1000, false);
if (avatarKey >= (2 * bannerLen + 1)) {
avatarSwiperClone && avatarSwiperClone.slideTo(bannerLen + 1, 0);
avatarSwiper.slideTo(bannerLen + 1, 0);
} else if (avatarKey <= (bannerLen - 1)) {
avatarSwiperClone && avatarSwiperClone.slideTo(2 * bannerLen - 1, 0);
avatarSwiper.slideTo(2 * bannerLen - 1, 0);
} else {
avatarSwiperClone && avatarSwiperClone.slideTo(avatarKey, 0);
avatarSwiper.slideTo(avatarKey, 0);
}
avatarSwiper.slideTo(avatarKey, 1000, false);
}
});
... ...