Authored by zhangxiaoru

plus明星原创

... ... @@ -9,20 +9,14 @@ var mySwiper;
require('../common');
lazyLoad($('img.lazy'));
$('.star-content li').each(function(key, item) {
$(item).find('.swiper-container').addClass('swiper-' + key);
var mySwiper;
mySwiper = new Swiper('.swiper-' + key, {
lazyLoading: true,
pagination: '.swiper-' + key + ' .pagination-inner'
});
});
lazyLoad($('img.lazy'));
$('#nav-tab').bind('contextmenu', function(e) {
return false;
});
$('#nav-tab').on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li');
... ... @@ -30,11 +24,32 @@ $('#nav-tab').on('touchend touchcancel', function(e) {
return;
}
$navs.toggleClass('focus');
$contents.toggleClass('hide');
$navs.removeClass('focus');
$this.addClass('focus');
$contents.addClass('hide');
$contents.eq($this.index()).removeClass('hide');
if (typeof $this.swiper === 'undefined') {//解决隐藏式,swiper不渲染
$this.swiper = false;
$contents.find('li').each(function(key, item) {
$(item).find('.swiper-container').addClass('swiper-' + key);
mySwiper = new Swiper('.swiper-' + key, {
lazyLoading: true,
pagination: '.swiper-' + key + ' .pagination-inner'
});
});
}
$(document).trigger('scroll'); //Trigger lazyLoad
});
if ($('#nav-tab').find('li:eq(0)').hasClass('focus')) {
//解决li隐藏 swiper不渲染的问题
$('#nav-tab').find('li:eq(0)').removeClass('focus');
$('#nav-tab').find('li:eq(0)').trigger('touchend');
}
$('#nav-tab').on('touchstart', function(e) {
var target = e.target || e.srcElement;
... ...