Authored by Lynnic

js代码优化

... ... @@ -7,7 +7,10 @@
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload');
var goodsSwiper;
var goodsSwiper,
$discountFolder = $('.goods-discount .discount-folder'),
$discountArrow = $('.goodsDiscount .first-item span');
require('./desc');
require('./comments-consults');
... ... @@ -29,18 +32,18 @@ goodsSwiper = new Swiper('.banner-swiper', {
//初始化goods-discount
if (0 === $('.goods-discount .discount-folder').children().length) {
$('.goods-discount .discount-folder').css('display', 'none');
$('.goods-discount .first-item span').html('');
$discountFolder.css('display', 'none');
$discountArrow.html('');
}
//goods-discount下拉按钮点击事件
$('.goodsDiscount .dropdown').on('click', function() {
if ($('.goodsDiscount .discount-folder').is(':hidden')) {
$('.goodsDiscount .first-item span').removeClass('icon-down').addClass('icon-up').html('');
$('.goodsDiscount .discount-folder').slideDown();
if ($discountFolder.is(':hidden')) {
$discountArrow.removeClass('icon-down').addClass('icon-up').html('');
$discountFolder.slideDown();
} else {
$('.goodsDiscount .first-item span').removeClass('icon-up').addClass('icon-down').html('');
$('.goodsDiscount .discount-folder').slideUp();
$discountArrow.removeClass('icon-up').addClass('icon-down').html('');
$discountFolder.slideUp();
}
});
require('./like');
\ No newline at end of file
... ...