...
|
...
|
@@ -6,6 +6,8 @@ |
|
|
|
|
|
var $ = require('yoho-jquery'),
|
|
|
Swiper = require('yoho-swiper'),
|
|
|
|
|
|
// inView = require('in-view'),
|
|
|
loading = require('../plugin/loading'),
|
|
|
PullRefresh = require('../plugin/pull-refresh');
|
|
|
|
...
|
...
|
@@ -31,6 +33,12 @@ var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, ba |
|
|
|
|
|
var swiperNum = $('.avatar-wrap .swiper-slide').width() / 2;
|
|
|
|
|
|
// var $gif = $('img[data-original*="gif"]');
|
|
|
|
|
|
if ($('.star-main').css('height') === '0px') {
|
|
|
$('.star-main').css('height', $window.height() - $('.head-tab').height());
|
|
|
}
|
|
|
|
|
|
if ($window.width() === 375 && isiOS) {
|
|
|
swiperNum = 32;
|
|
|
}
|
...
|
...
|
@@ -38,11 +46,29 @@ if ($window.width() === 375 && isiOS) { |
|
|
require('../common');
|
|
|
require('yoho-jquery-lazyload');
|
|
|
|
|
|
// require('yoho-jquery-inview');
|
|
|
|
|
|
$window.on('mousewheel', false);
|
|
|
$('#yoho-header, .head-tab').on('touchmove', function() {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
// inView(document.querySelectorAll('img[data-original*="gif"]'))
|
|
|
// .on('enter', function() {
|
|
|
// console.log(1);
|
|
|
// })
|
|
|
// .on('exit', function() {
|
|
|
// console.log(2);
|
|
|
// });
|
|
|
|
|
|
// $('img[data-original*="gif"]').on('inview', function(event, isInView) {
|
|
|
// if (isInView) {
|
|
|
// $(this).css('display', 'block');
|
|
|
// } else {
|
|
|
// $(this).css('display', 'none');
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
// 限制标题字数
|
|
|
// function txtLimit() {
|
|
|
//
|
...
|
...
|
@@ -95,7 +121,6 @@ function setIndexAction() { |
|
|
|
|
|
// 明星头像 swiper 初始化
|
|
|
if (bannerLen > 1) {
|
|
|
console.log(Math.floor($avatarWrap.find('.swiper-slide').length / 2));
|
|
|
avatarSwiper = new Swiper($avatarWrap.find('.avatar-swiper')[0], {
|
|
|
lazyLoading: true,
|
|
|
lazyLoadingInPrevNextAmount: 3,
|
...
|
...
|
@@ -183,6 +208,7 @@ getIndexHtml = function() { |
|
|
$.ajax({
|
|
|
url: '/guang/star/getIndexHtml',
|
|
|
dataType: 'html',
|
|
|
timeout: 5000
|
|
|
})
|
|
|
.done(function(data) {
|
|
|
if (data) {
|
...
|
...
|
@@ -217,54 +243,57 @@ starIScroll.iScroll.on('scrollStart', function() { |
|
|
// if (this.directionY === -1) {
|
|
|
// $loadingTip.slideDown();
|
|
|
// }
|
|
|
|
|
|
// $gif.css('display', 'none');
|
|
|
bannerSwiper && bannerSwiper.startAutoplay();
|
|
|
});
|
|
|
|
|
|
// starIScroll.iScroll.on('scroll', function() {
|
|
|
// var avatarOffsetT;
|
|
|
//
|
|
|
// if (this.directionY !== -1) {
|
|
|
// setTimeout(function() {
|
|
|
// starIScroll.iScroll.refresh();
|
|
|
// }, 0);
|
|
|
// }
|
|
|
//
|
|
|
// avatarOffsetT = $avatarWrap[0].offsetTop;
|
|
|
//
|
|
|
// if (-this.y >= avatarOffsetT) {
|
|
|
// $avatarClone.show();
|
|
|
//
|
|
|
// if (!avatarSwiperClone) {
|
|
|
// avatarSwiperClone = new Swiper($avatarClone[0], {
|
|
|
// loop: true,
|
|
|
// initialSlide: $avatarWrap.find('.swiper-slide-active').index() % bannerLen,
|
|
|
// centeredSlides: true,
|
|
|
// slidesPerView: 'auto',
|
|
|
// loopedSlides: bannerLen,
|
|
|
// spaceBetween: 10,
|
|
|
// slidesOffsetBefore: -swiperNum,
|
|
|
// watchSlidesProgress: true,
|
|
|
// watchSlidesVisibility: true,
|
|
|
// onInit: function() {
|
|
|
// $avatarClone.find('li').on('click', function() {
|
|
|
// res = bindAvatar($(this));
|
|
|
// return res;
|
|
|
// });
|
|
|
// }
|
|
|
// });
|
|
|
//
|
|
|
// avatarSwiperClone.params.control = avatarSwiper;
|
|
|
// avatarSwiper.params.control = avatarSwiperClone;
|
|
|
// }
|
|
|
// } else {
|
|
|
// $avatarClone.hide();
|
|
|
// }
|
|
|
// });
|
|
|
starIScroll.iScroll.on('scroll', function() {
|
|
|
// var avatarOffsetT;
|
|
|
//
|
|
|
// if (this.directionY !== -1) {
|
|
|
// setTimeout(function() {
|
|
|
// starIScroll.iScroll.refresh();
|
|
|
// }, 0);
|
|
|
// }
|
|
|
//
|
|
|
// avatarOffsetT = $avatarWrap[0].offsetTop;
|
|
|
//
|
|
|
// if (-this.y >= avatarOffsetT) {
|
|
|
// $avatarClone.show();
|
|
|
//
|
|
|
// if (!avatarSwiperClone) {
|
|
|
// avatarSwiperClone = new Swiper($avatarClone[0], {
|
|
|
// lazyLoading: true,
|
|
|
// lazyLoadingInPrevNext: true,
|
|
|
//
|
|
|
// // loop: true,
|
|
|
// initialSlide: $avatarWrap.find('.swiper-slide-active').index() % bannerLen,
|
|
|
// centeredSlides: true,
|
|
|
// slidesPerView: 'auto',
|
|
|
// loopedSlides: bannerLen,
|
|
|
// spaceBetween: 10,
|
|
|
// slidesOffsetBefore: -swiperNum,
|
|
|
// watchSlidesProgress: true,
|
|
|
// watchSlidesVisibility: true,
|
|
|
// onInit: function() {
|
|
|
// $avatarClone.find('li').on('click', function() {
|
|
|
// res = bindAvatar($(this));
|
|
|
// return res;
|
|
|
// });
|
|
|
// }
|
|
|
// });
|
|
|
//
|
|
|
// avatarSwiperClone.params.control = avatarSwiper;
|
|
|
// avatarSwiper.params.control = avatarSwiperClone;
|
|
|
// }
|
|
|
// } else {
|
|
|
// $avatarClone.hide();
|
|
|
// }
|
|
|
});
|
|
|
|
|
|
starIScroll.iScroll.on('scrollEnd', function() {
|
|
|
// $loadingTip.slideUp();
|
|
|
|
|
|
// $gif.css('display', 'block');
|
|
|
bannerSwiper && bannerSwiper.stopAutoplay();
|
|
|
});
|
|
|
|
...
|
...
|
|