list.js
1.12 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
/**
* PLUS+STAR列表页
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/10
*/
var $ = require('jquery'),
lazyLoad = require('yoho.lazyload'),
Swiper = require('yoho.iswiper');
var $navs = $('#nav-tab > li'),
$contents = $('#ps-content > .content');
var mySwiper;
lazyLoad($('img.lazy'));
$('.star-content li').each(function(key, item) {
$(item).find('.swiper-container').addClass('swiper-' + key);
mySwiper = new Swiper('.swiper-' + key, {
lazyLoading: true,
pagination: '.swiper-' + key + ' .pagination-inner'
});
});
$('#nav-tab').bind('contextmenu', function(e) {
return false;
});
$('#nav-tab').on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li');
if ($this.hasClass('focus')) {
return;
}
$navs.toggleClass('focus');
$contents.toggleClass('hide');
$(document).trigger('scroll'); //Trigger lazyLoad
});
$('#nav-tab').on('touchstart', function(e) {
var target = e.target || e.srcElement;
target.className = 'bytouch ' + target.className;
}).on('touchend touchcancel', function() {
$navs.removeClass('bytouch');
});