Authored by biao

rollback outlet.page.js

var $ = require('yoho-jquery'),
iscroll = require('./outlet/nav'),
lazyLoad = require('yoho-jquery-lazyload');
var Swiper,
Countdown;
Swiper = require('yoho-swiper'),
lazyLoad = require('yoho-jquery-lazyload'),
Countdown = require('./outlet/countdown');
var $el = $('.cd-lite');
var $categoryNavItem = $('.outlet-category-nav a');
var $moreBtn = $('.more-activity');
var $categoryNav = $('.outlet-category-nav');
var $slider = $('.swiper-container .swiper-slide');
var $topNav = $('#index_nav');
var search = require('./sale/search');
var iscroll = require('./outlet/nav');
require('./outlet/fix-nav');
... ... @@ -41,27 +35,17 @@ function searchInitParam(dom) {
return query;
}
if ($el && $el.length > 0) {
Countdown = require('./outlet/countdown');
if ($el.length > 0) {
$el.each(function() {
new Countdown.Countdown({
el: $(this)
});
});
}
$('.outlet-category-nav').fixNav();
if ($categoryNav && $categoryNav.length > 0) {
// $categoryNav.fixNav();
iscroll({
el: '.outlet-category-nav'
}).goto(0);
}
if ($slider && $slider.length > 1) {
Swiper = require('yoho-swiper');
$('.outlet-category-nav').fixNav();
if ($('.swiper-container .swiper-slide').length > 1) {
new Swiper('.swiper-container', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
... ... @@ -81,8 +65,7 @@ $('.nav-back').on('click', function(e) {
location.href = '//m.yohobuy.com/' + channel;
});
if ($categoryNavItem && $categoryNavItem.length > 0) {
$categoryNavItem.on('click', function(e) {
$categoryNavItem.on('click', function(e) {
var query = searchInitParam($(this));
$('.category a').removeClass('active');
... ... @@ -93,21 +76,30 @@ if ($categoryNavItem && $categoryNavItem.length > 0) {
search.start({
type: 'category'
}, query);
});
});
// 触发第一个search
if ($categoryNavItem.length > 0) {
// $categoryNavItem.eq(0).trigger('click');
// 触发第一个search
search.start({
type: 'category'
}, searchInitParam($categoryNavItem.eq(0)));
}
// 导航滚动
if ($topNav && $topNav.length > 0) {
if ($('#index_nav').length > 0) {
iscroll({
el: '#index_nav'
}).goto($('#index_nav').find('.active').index());
}
if ($('.outlet-category-nav').length > 0) {
iscroll({
el: '.outlet-category-nav'
}).goto(0);
}
// 更多活动按钮
if ($('.back-ground-white').length > 10) {
$('.more-activity').show();
... ... @@ -118,13 +110,11 @@ if ($('.back-ground-white').length > 10) {
});
}
if ($moreBtn && $moreBtn.length > 0) {
$moreBtn.click(function() {
$('.more-activity').click(function() {
$('.more-activity').hide();
$('.back-ground-white').each(function(index, e) {
if (index > 9) {
$(e).show();
}
});
});
}
});
... ...