...
|
...
|
@@ -64,11 +64,13 @@ function setAvatar($userAvatar) { |
|
|
|
|
|
function setIndexAction() {
|
|
|
var starIScroll;
|
|
|
var commonHeaderTop = $('#yoho-header').outerHeight();
|
|
|
var $loadingTip = $('.loading-tip');
|
|
|
var $avatarWrap = $('.avatar-wrap');
|
|
|
|
|
|
// 下拉刷新,上拉加载
|
|
|
starIScroll = new PullRefresh('.star-wrap', {
|
|
|
height: $(window).height() - $('#yoho-header').height() - $('.head-tab').height(),
|
|
|
height: $(window).height() - commonHeaderTop,
|
|
|
pullDown: function() {
|
|
|
if (!stopLoading) {
|
|
|
stopLoading = true;
|
...
|
...
|
@@ -86,8 +88,13 @@ function setIndexAction() { |
|
|
});
|
|
|
|
|
|
starIScroll.iScroll.on('scroll', function() {
|
|
|
if (this.startY < -180) {
|
|
|
console.log('111');
|
|
|
if (commonHeaderTop > $avatarWrap.offset().top) {
|
|
|
// $('.avatar-clone').css('top', $('.head-tab').outerHeight());
|
|
|
$('.avatar-clone').show();
|
|
|
starIScroll[0].update();
|
|
|
starIScroll[1].update();
|
|
|
} else {
|
|
|
$('.avatar-clone').hide();
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -190,7 +197,7 @@ function setIndexAction() { |
|
|
// }
|
|
|
|
|
|
if (bannerLen > 1) {
|
|
|
avatarSwiper[0] = new Swiper('.avatar-0', {
|
|
|
avatarSwiper = new Swiper('.avatar', {
|
|
|
loop: true,
|
|
|
|
|
|
// loopedSlides: bannerLen,
|
...
|
...
|
@@ -198,12 +205,15 @@ function setIndexAction() { |
|
|
centeredSlides: true,
|
|
|
slidesPerView: 'auto',
|
|
|
spaceBetween: 10,
|
|
|
slidesOffsetBefore: '-' + $('.avatar-0').find('li').not('.swiper-slide-visible').width() / 2,
|
|
|
slidesOffsetBefore: -($('.avatar').find('li').not('.swiper-slide-visible').width() / 2),
|
|
|
watchSlidesProgress: true,
|
|
|
watchSlidesVisibility: true,
|
|
|
observer: true,
|
|
|
observeParents: true
|
|
|
});
|
|
|
|
|
|
avatarSwiper[0].params.control = avatarSwiper[1];// 需要在Swiper2初始化后,Swiper1控制Swiper2
|
|
|
avatarSwiper[1].params.control = avatarSwiper[0];// 需要在Swiper1初始化后,Swiper2控制Swiper1
|
|
|
}
|
|
|
|
|
|
// 明星动态头像左右滑动
|
...
|
...
|
@@ -247,6 +257,8 @@ function setIndexAction() { |
|
|
}
|
|
|
|
|
|
getIndexHtml = function() {
|
|
|
var $starMain = $('.star-main');
|
|
|
|
|
|
loading.showLoadingMask();
|
|
|
$.ajax({
|
|
|
url: '/guang/star/getIndexHtml',
|
...
|
...
|
@@ -254,14 +266,15 @@ getIndexHtml = function() { |
|
|
success: function(data) {
|
|
|
stopLoading = false;
|
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
if (!data) {
|
|
|
stopLoading = true;
|
|
|
tip.show('没有更多内容了');
|
|
|
}
|
|
|
|
|
|
$('.star-main').html(data);
|
|
|
$starMain.html(data);
|
|
|
bannerLen = $('.avatar .swiper-slide').length;
|
|
|
|
|
|
$starMain.prepend($('.avatar-swiper').clone().addClass('avatar-clone').hide());
|
|
|
|
|
|
// 限制标题字数
|
|
|
$('.cont-area').each(function() {
|
...
|
...
|
@@ -270,7 +283,6 @@ getIndexHtml = function() { |
|
|
|
|
|
loading.hideLoadingMask();
|
|
|
lazyLoad($('img.lazy'));
|
|
|
bannerLen = $('.avatar-0 .swiper-slide').length;
|
|
|
|
|
|
setTimeout(function() {
|
|
|
setIndexAction();
|
...
|
...
|
|