detail.js 1.52 KB
/**
 *  商品详情
 * @author: liangzhifeng<zhifeng.liang@yoho.cn>
 * @date: 2015/10/20
 */
 var $ = require('jquery'),
    Swiper = require('yoho.iswiper'),
    lazyLoad = require('yoho.lazyload');

var goodsSwiper;

require('./desc');
require('./comments-consults');


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

//顶部swiper
goodsSwiper = new Swiper('.banner-swiper', {
    lazyLoading: true,
    lazyLoadingInPrevNext: true,
    paginationClickable: true,
    pagination: '.banner-top .pagination-inner',
    nextButton: '.my-swiper-button-next',
    prevButton: '.my-swiper-button-prev'
});


(function() {

    //初始化goods-discount
    if (0 === $('.goods-discount .discount-folder').children().length) {
        $('.goods-discount .discount-folder').css('display', 'none');
        $('.goods-discount .first-item span').html('');
    }
})();

//goods-discount下拉按钮点击事件
$('.goodsDiscount .dropdown').on('click', function() {
    if ($('.goodsDiscount .discount-folder').is(':hidden')) {
        $('.goodsDiscount .first-item span').removeClass('icon-down');
        $('.goodsDiscount .first-item span').addClass('icon-up');
        $('.goodsDiscount .first-item span').html('&#xe608;');
        $('.goodsDiscount .discount-folder').slideDown();
    } else {
        $('.goodsDiscount .first-item span').removeClass('icon-up');
        $('.goodsDiscount .first-item span').addClass('icon-down');
        $('.goodsDiscount .first-item span').html('&#xe609;');
        $('.goodsDiscount .discount-folder').slideUp();
    }
});

require('./like');