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

var $this, $title;

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

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

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

$('.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);
        });
    }
});