installment.page.js 959 Bytes
var $ = require('yoho-jquery'),
    ellipsis = require('yoho-mlellipsis'),
    lazyLoad = require('yoho-jquery-lazyload');

var $installmentOnly = $('.installment-only');

var $this, $title;

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

$('.good-detail-text .name').each(function() {
    $this = $(this);
    $title = $this.find('a');

    $title[0].mlellipsis(2);
});

if ($installmentOnly.length > 0) {
    $('.installment-page').css({
        background: '#efefef'
    });
}

if ($('.installment-bg').length > 0) {
    $('body').css({
        background: '#efefef'
    });
}

$('.detail-tab span').on('click', function() {
    $(this).addClass('on').siblings().removeClass('on');
    $('.installment-cont').hide().eq($(this).index()).show();

    if ($(this).index() === 1) {
        $('.good-detail-text .name').each(function() {
            $this = $(this);
            $title = $this.find('a');

            $title[0].mlellipsis(2);
        });
    }
});