suggest.js
950 Bytes
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
/**
* 个人中心--意见反馈
* @author: chenglong<chenglong.wang@yoho.cn>
* @date: 2015/11/12
*/
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content');
var $curContainer = $favContainer.children('.fav-type').first();//保存当前显示的$favContainer
var favTabHammer;
//lazyLoad();
favTabHammer = new Hammer(document.getElementById('fav-tab'));
favTabHammer.on('tap', function(e) {
console.log(1);
var $cur = $(e.target).closest('li'),
index;
if ($cur.length === 0 || $cur.hasClass('active')) {
return;
}
index = $cur.index();
$navLi.filter('.active').removeClass('active');
$cur.addClass('active');
$curContainer.addClass('hide');
$curContainer = $favContainer.children(':eq(' + index + ')').removeClass('hide');
});