red-shop.js 1.07 KB
/*
 * @Author: Targaryen
 * @Date: 2017-03-23 11:31:51
 * @Last Modified by: Targaryen
 * @Last Modified time: 2017-03-23 18:37:04
 */
/* 红人店铺首页 */
const Swiper2 = require('yoho-swiper2');

let $shopIntroFolder = $('.shop-intro-folder');
let $shortIntro = $('#shortIntro');
let $shopIntro = $('#shopIntro');
let $shopIntrArrw = $('#shopIntrArrw');

/**
 * 店铺介绍展开收起
 */
$shopIntroFolder.on('click', function() {
    $shortIntro.toggleClass('hide');
    $shopIntro.toggleClass('active');

    if ($shopIntro.hasClass('active')) {
        $shopIntrArrw.html('');
    } else {
        $shopIntrArrw.html('');
    }
});

/**
 * 店铺轮播图
 */
if ($('.shop-swiper')) {
    let num = $('.shop-swiper').length;

    for (let i = 1; i <= num; i++) {
        new Swiper2('.shop-swiper-' + i, {
            lazyLoading: true,
            lazyLoadingInPrevNext: true,
            loop: true,
            autoplay: 3000,
            autoplayDisableOnInteraction: false,
            paginationClickable: true,
            slideElement: 'li',
        });
    }
}