outlet.page.js 1.49 KB
var $ = require('yoho-jquery'),
    Swiper = require('yoho-swiper'),
    lazyLoad = require('yoho-jquery-lazyload');

var iscroll = require('./outlet/nav');

require('./sale/search');

lazyLoad($('img.lazy'));

// nav({
//    navClass: '.outlet-nav'
// })




if ($('.swiper-container .swiper-slide').length > 1) {
    new Swiper('.swiper-container', {
        lazyLoading: true,
        lazyLoadingInPrevNext: true,
        loop: true,
        autoplay: 3000,
        autoplayDisableOnInteraction: true,
        paginationClickable: true,
        pagination: '.banner-top .pagination-inner'
    });
}


$('.outlet-category-nav').on('click', 'a', function(e) {
    var href = $(this).attr('href'), // eslint-disable-line
        querys = href.split('?')[1].split('&');

    var query = {};

    e.preventDefault();

    querys.forEach(function(value) {
        var queryPairs = value.split('='),
            key = queryPairs[0],
            val = queryPairs[1];

        query[key] = val;
    });

    // search(null, query);
});

if (('.outlet-page').length > 0) {
    $('.more-activity').on('click', function() {
        $('.more-activity').addClass('hidden');
        $('.back-ground-white').removeClass('hidden');
    });
}


if (('.outlet-page').length > 0) {

    $('.outlet-nav').find('li').each(function() {
        // $(this).on('click', function() {

        // });
    });


}

// 导航滚动
iscroll({
    el: '#index_nav'
}).goto($('#index_nav').find('.active').index());

iscroll({
    el: '#list-nav'
}).goto(0);