...
|
...
|
@@ -60,7 +60,6 @@ function setAvatar($userAvatar) { |
|
|
}
|
|
|
|
|
|
function ajaxHtml() {
|
|
|
|
|
|
loading.showLoadingMask();
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
...
|
...
|
@@ -148,6 +147,25 @@ function setIndexAction() { |
|
|
$avatar0.hide();
|
|
|
$avatar1.show();
|
|
|
|
|
|
if(!avatarSwiper[1]) {
|
|
|
avatarSwiper[1] = new Swiper('.avatar-1', {
|
|
|
loop: true,
|
|
|
// loopedSlides: bannerLen,
|
|
|
initialSlide: 2,
|
|
|
centeredSlides: true,
|
|
|
slidesPerView: 'auto',
|
|
|
spaceBetween: 10,
|
|
|
slidesOffsetBefore: '-' + $('.avatar-1').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
|
|
|
}
|
|
|
|
|
|
// avatarSwiper[1].slideTo($avatar0.find('.swiper-slide-active').index(), 1000, false);
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -230,26 +248,40 @@ function setIndexAction() { |
|
|
}
|
|
|
|
|
|
// 明星头像 swiper 初始化
|
|
|
// if (bannerLen > 1) {
|
|
|
// $('.avatar-swiper').each(function(key, item) {
|
|
|
// avatarSwiper[key] = new Swiper('.avatar-' + key, {
|
|
|
// loop: true,
|
|
|
// // loopedSlides: bannerLen,
|
|
|
// initialSlide: 2,
|
|
|
// centeredSlides: true,
|
|
|
// slidesPerView: 'auto',
|
|
|
// spaceBetween: 10,
|
|
|
// slidesOffsetBefore: '-' + $(item).find('li').not('.swiper-slide-visible').width() / 2,
|
|
|
// watchSlidesProgress: true,
|
|
|
// watchSlidesVisibility: true,
|
|
|
// observer: true,
|
|
|
// observeParents: true
|
|
|
// });
|
|
|
// });
|
|
|
// }
|
|
|
|
|
|
if (bannerLen > 1) {
|
|
|
$('.avatar-swiper').each(function(key, item) {
|
|
|
avatarSwiper[key] = new Swiper('.avatar-' + key, {
|
|
|
loop: true,
|
|
|
loopedSlides: bannerLen,
|
|
|
initialSlide: 3,
|
|
|
centeredSlides: true,
|
|
|
slidesPerView: 'auto',
|
|
|
slidesOffsetBefore: '-' + $(item).find('li').not('.swiper-slide-visible').width() / 2,
|
|
|
watchSlidesProgress: true,
|
|
|
watchSlidesVisibility: true,
|
|
|
observer: true,
|
|
|
observeParents: true
|
|
|
});
|
|
|
avatarSwiper[0] = new Swiper('.avatar-0', {
|
|
|
loop: true,
|
|
|
// loopedSlides: bannerLen,
|
|
|
initialSlide: 2,
|
|
|
centeredSlides: true,
|
|
|
slidesPerView: 'auto',
|
|
|
spaceBetween: 10,
|
|
|
slidesOffsetBefore: '-' + $('.avatar-0').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
|
|
|
|
|
|
// 明星动态头像左右滑动
|
|
|
if ($('.article-avatar-swiper').find('li').length > 1) {
|
|
|
new Swiper('.article-avatar-swiper', {
|
...
|
...
|
|