footer.js
2.98 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
* 底部JS
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/10/26
*/
var $ = require('jquery'),
Hammer = require('hammer');
var $searchBox = $('.search-box'),
$indexSearch = $('.index-search'),
$indexLogo = $('.index-logo');
var floatLayerCloseHammer, floatLayerBtnHammer;
function downLoadApp() {
var appUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
var clickedAt = new Date();
setTimeout(function () {
if ((new Date()) - clickedAt < 2000) {
window.location = appUrl;
}
}, 500);
}
// $('#float-layer-close').bind('tap', function () {
// $('#float-layer-app').hide();
// window.setCookie('_float-layer-app', 'id490655927',
// {
// domain: '.yohobuy.com'
// });
// window.setCookie('_float-layer-app-close', 1,
// {
// domain: '.yohobuy.com',
// expires: 1
// });
// });
if ($('#float-layer-close') && $('#float-layer-close')[0]) {
floatLayerCloseHammer = new Hammer($('#float-layer-close')[0]);
floatLayerCloseHammer.on('tap', function(e) {
$('#float-layer-app').hide();
window.setCookie('_float-layer-app', 'id490655927',
{
domain: '.yohobuy.com'
});
window.setCookie('_float-layer-app-close', 1,
{
domain: '.yohobuy.com',
expires: 1
});
});
}
// $('#float-layer-btn').tap(function () {
// downLoadApp('bottom');
// });
if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
floatLayerBtnHammer.on('tap', function(e) {
downLoadApp('bottom');
});
if (!window.cookie('_float-layer-app')) {
$('#float-layer-app').show();
} else {
$('#float-layer-app').hide();
}
}
/**
* 频道选择页面顶部搜索
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/10/28
*/
$searchBox.find('input').on('focus', function () {
$indexLogo.css({
width: 0,
display: 'none'
});
$searchBox.css({
width: '12.8rem'
});
$indexSearch.css({
width: '15.5rem'
});
$('.clear-text, .no-search').show();
}).on('blur', function () {
$indexLogo.css({
width: '5.4rem',
display: 'block'
});
$searchBox.css({
width: '8.8rem'
});
$indexSearch.css({
width: '9.6rem'
});
$('.clear-text, .no-search').hide();
});
$searchBox.find('.clear-text').click(function () {
$searchBox.find('input').val('').trigger('focus');
});
// clearTextHammer = new Hammer($searchBox.find('.clear-text')[0]);
// clearTextHammer.on('tap', function(e) {
// $searchBox.find('input').val('').trigger('focus');
// });
$searchBox.find('.search-icon').click(function () {
$indexSearch.submit();
});
// searchIconHammer = new Hammer($searchBox.find('.search-icon')[0]);
// searchIconHammer.on('tap', function(e) {
// $indexSearch.submit();
// });