index.js 551 Bytes
/**
 * 购物车Logic
 * @author: xuqi<qi.xu@yoho.cn>
 * @date: 2015/10/20
 */

var $ = require('yoho.zepto');

var $cartContent = $('.cart-content');

require('./good');

$('.cart-nav').delegate('li', 'touchstart', function() {
    var $this = $(this);

    if ($this.hasClass('active')) {
        return;
    }

    $this.siblings('.active').removeClass('active');
    $this.addClass('active');

    //切换普通商品和预售商品购物车显示
    $cartContent.toggleClass('hide');

    //trigger lazyload
    $(window).trigger('scroll');
});