recommend-for-you.js 638 Bytes
/**
 * 为您优选
 * @author: bikai<kai.bi@yoho.cn>
 * @date: 2015/11/16
 */


var Swiper = require('yoho.iswiper'),
    $ = require('jquery');

var recommendSwiper,
    $recommendForYou = $('.recommend-for-you');

$.get('/home/preference').then(function(html) {
    $recommendForYou.html(html);
    if ($('#swiper-recommend').length) {
        recommendSwiper = new Swiper('#swiper-recommend', {
            slidesPerView: 'auto',
            grabCursor: true,
            slideElement: 'li',
            lazyLoading: true,
            watchSlidesVisibility: true
        });
    }
}).fail(function() {
    $recommendForYou.hide();
});