|
@@ -5,6 +5,7 @@ |
|
@@ -5,6 +5,7 @@ |
5
|
*/
|
5
|
*/
|
6
|
|
6
|
|
7
|
var $ = require('yoho-jquery');
|
7
|
var $ = require('yoho-jquery');
|
|
|
8
|
+var FastClick = require('yoho-fastclick');
|
8
|
|
9
|
|
9
|
var $nav = $('.category-nav'),
|
10
|
var $nav = $('.category-nav'),
|
10
|
$search = $('#search-input'),
|
11
|
$search = $('#search-input'),
|
|
@@ -15,6 +16,10 @@ var $nav = $('.category-nav'), |
|
@@ -15,6 +16,10 @@ var $nav = $('.category-nav'), |
15
|
|
16
|
|
16
|
require('../common');
|
17
|
require('../common');
|
17
|
|
18
|
|
|
|
19
|
+$(function() {
|
|
|
20
|
+ FastClick.attach(document.body);
|
|
|
21
|
+})
|
|
|
22
|
+
|
18
|
function resetHeight() {
|
23
|
function resetHeight() {
|
19
|
var h = document.body.scrollHeight - $search.outerHeight() - $nav.outerHeight();
|
24
|
var h = document.body.scrollHeight - $search.outerHeight() - $nav.outerHeight();
|
20
|
|
25
|
|
|
@@ -47,7 +52,7 @@ $nav.on('touchend touchcancel', function(e) { |
|
@@ -47,7 +52,7 @@ $nav.on('touchend touchcancel', function(e) { |
47
|
$contents.filter(selector).removeClass('hide');
|
52
|
$contents.filter(selector).removeClass('hide');
|
48
|
});
|
53
|
});
|
49
|
|
54
|
|
50
|
-$categoryContainer.on('touchend', function(e) {
|
55
|
+$categoryContainer.on('click', function(e) {
|
51
|
var $this = $(e.target),
|
56
|
var $this = $(e.target),
|
52
|
$subLevel,
|
57
|
$subLevel,
|
53
|
$cur, index;
|
58
|
$cur, index;
|
|
@@ -59,6 +64,14 @@ $categoryContainer.on('touchend', function(e) { |
|
@@ -59,6 +64,14 @@ $categoryContainer.on('touchend', function(e) { |
59
|
e.preventDefault();
|
64
|
e.preventDefault();
|
60
|
}
|
65
|
}
|
61
|
|
66
|
|
|
|
67
|
+ if ($this[0] && $this[0].tagName === 'LI' && $this.find('a').attr('href')) {
|
|
|
68
|
+ location.href = $this.find('a').attr('href');
|
|
|
69
|
+ }
|
|
|
70
|
+
|
|
|
71
|
+ if ($this[0] && $this[0].tagName === 'A' && $this.attr('href')) {
|
|
|
72
|
+ location.href = $this.attr('href');
|
|
|
73
|
+ }
|
|
|
74
|
+
|
62
|
if ($cur.length > 0) {
|
75
|
if ($cur.length > 0) {
|
63
|
index = $cur.index();
|
76
|
index = $cur.index();
|
64
|
$subLevel = $this.closest('.content').find('.sub-level');
|
77
|
$subLevel = $this.closest('.content').find('.sub-level');
|
|
@@ -73,14 +86,6 @@ $categoryContainer.on('touchend', function(e) { |
|
@@ -73,14 +86,6 @@ $categoryContainer.on('touchend', function(e) { |
73
|
$subLevel.not('.hide').addClass('hide');
|
86
|
$subLevel.not('.hide').addClass('hide');
|
74
|
$subLevel.eq(index).removeClass('hide');
|
87
|
$subLevel.eq(index).removeClass('hide');
|
75
|
}
|
88
|
}
|
76
|
-
|
|
|
77
|
- if ($this[0] && $this[0].tagName === 'LI' && $this.find('a').attr('href')) {
|
|
|
78
|
- location.href = $this.find('a').attr('href');
|
|
|
79
|
- }
|
|
|
80
|
-
|
|
|
81
|
- if ($this[0] && $this[0].tagName === 'A' && $this.attr('href')) {
|
|
|
82
|
- location.href = $this.attr('href');
|
|
|
83
|
- }
|
|
|
84
|
});
|
89
|
});
|
85
|
|
90
|
|
86
|
$categoryContainer.find('.primary-level').on('touchstart touchend touchcancel', 'li', function() {
|
91
|
$categoryContainer.find('.primary-level').on('touchstart touchend touchcancel', 'li', function() {
|