installment.page.js
1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var $ = require('yoho-jquery'),
ellipsis = require('yoho-mlellipsis'),
ListData = require('./installment-goods'),
lazyLoad = require('yoho-jquery-lazyload');
require('../common');
lazyLoad($('img.lazy'));
ellipsis.init();
new ListData({
url: '/home/installment/get-goods',
page: 1,
boxArea: $('#goods-list')
});
function setDetailText() {
var $this, $title;
$('.good-detail-text .name').each(function() {
$this = $(this);
$title = $this.find('a');
$title[0].mlellipsis(2);
});
}
function setDefaultHeight() {
var $detailImg = $('.good-detail-img');
$detailImg.css({
height: $detailImg.find('img').height() - 1,
background: '#c3c3c3'
});
}
setDetailText();
$('.detail-tab span').on('click', function() {
$(this).addClass('on').siblings().removeClass('on');
$('.installment-cont').hide().eq($(this).index()).show();
if ($(this).index() === 1) {
setDetailText();
lazyLoad($('img.lazy'));
setTimeout(function() {
setDefaultHeight();
}, 2000);
}
});
setTimeout(function() {
setDefaultHeight();
}, 2500);
window.setCookie('installmentUid', window.queryString.uid);
window.setCookie('udid', window.queryString.udid);
window.setCookie('clientType', window.queryString.client_type);