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

var $ = require('jquery');

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

require('./good');

$('.cart-nav').delegate('li', 'tap', 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');
});