pay.page.js
1.26 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
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
var prompt = $('.fraud-prompt'),
tipContent = $('.tip-content'),
tip = $('.tip'),
fraudTip = $('.fraud-tip');
var tipConWidth = tipContent.width(),
tipWidth = tip.width(),
promptWidth = prompt.width();
var scrollVal,
onePageW,
diff;
require('../common');
lazyLoad($('img.lazy'));
function getGender() {
return window.cookie('_Channel') || 'boys';
}
require('../channel/maybe-like')(getGender());
// 你可能喜欢没有数据就隐藏
setTimeout(function() {
if ($('#goods-list').find('.good-info').length === 0) {
$('.maybe-like').hide();
}
}, 200);
// 防诈骗提示滚动
if (tipConWidth > promptWidth - tipWidth) {
var speed = 30;
tipContent.width(tipConWidth + (promptWidth / 2));
fraudTip.append('<div class="tip-content">' + tipContent.html() + '</div>').css({
width: 2 * tipContent.width()
});
function Marquee() {
prompt.scrollLeft(prompt.scrollLeft() + 1);
scrollVal = prompt.scrollLeft();
onePageW = tipContent.eq(0).width();
diff = scrollVal - onePageW;
if (diff > 0) {
prompt.scrollLeft(Math.abs(diff));
}
}
setInterval(Marquee, speed);
}