Authored by 郝肖肖

sale 专区 js 延迟执行

... ... @@ -68,8 +68,6 @@ require('../common/suspend-cart'); // 悬浮购物车
ellipsis.init();
lazyLoad($('img.lazy'));
// 获取url里面的参数的值
function getUrlParam(name) {
// 构造一个含有目标参数的正则表达式对象
... ... @@ -91,20 +89,6 @@ defaultOpt = $.extend({
storeOpt = $.extend({}, defaultOpt);
if ($('.banner-swiper .swiper-slide').length > 1) {
new Swiper('.swiper-container', {
observer: true,
observeParents: true,
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: true,
paginationClickable: true,
pagination: '.banner-top .pagination-inner'
});
}
$.each($swiperSize, function(key) {
swipers[key] = new Swiper('#size-swiper-' + key, {
slidesPerView: 'auto'
... ... @@ -297,14 +281,14 @@ function search(opt) {
// lazy good-infos who append in
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
}
}
$('.good-detail-text .name').each(function() {
var $this = $(this),
$title = $this.find('a');
$('.good-detail-text .name').each(function() {
var $this = $(this),
$title = $this.find('a');
$title[0].mlellipsis(2);
});
$title[0].mlellipsis(2);
});
}
nav.reload = false;
nav.page = page;
... ... @@ -335,9 +319,7 @@ function filterInit(option) {
}, option),
success: function(data) {
if ($filterMask) {
$filterMask.remove();
}
$filterMask && $filterMask.remove();
$goodsContainer.append(data);
... ... @@ -360,7 +342,23 @@ function filterInit(option) {
});
}
lazyLoad($('.lazy'));
setTimeout(function() {
if ($('.banner-swiper .swiper-slide').length > 1) {
new Swiper('.swiper-container', {
observer: true,
observeParents: true,
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: true,
paginationClickable: true,
pagination: '.banner-top .pagination-inner'
});
}
lazyLoad($('.lazy'));
}, 50);
$listNav.bind('contextmenu', function() {
return false;
... ... @@ -464,7 +462,6 @@ $listNav.on('touchend touchcancel', function(e) {
e.stopPropagation();
});
// 尺码选择事件
$swiperSize.on('click', function(e) {
var $this = $(e.target).closest('li'),
... ...
@import "break-code";
@import "goods-list";
@import "../../common/suspend-cart";
@import "../../layout/_swiper.css";
@import "../../channel/_banner-top.css";
@import "../../channel/_floor-header.css";
... ...