...
|
...
|
@@ -5,6 +5,7 @@ |
|
|
*/
|
|
|
|
|
|
var $ = require('yoho-jquery');
|
|
|
var FastClick = require('yoho-fastclick');
|
|
|
|
|
|
var $nav = $('.category-nav'),
|
|
|
$search = $('#search-input'),
|
...
|
...
|
@@ -15,6 +16,10 @@ var $nav = $('.category-nav'), |
|
|
|
|
|
require('../common');
|
|
|
|
|
|
$(function() {
|
|
|
FastClick.attach(document.body);
|
|
|
})
|
|
|
|
|
|
function resetHeight() {
|
|
|
var h = document.body.scrollHeight - $search.outerHeight() - $nav.outerHeight();
|
|
|
|
...
|
...
|
@@ -47,7 +52,7 @@ $nav.on('touchend touchcancel', function(e) { |
|
|
$contents.filter(selector).removeClass('hide');
|
|
|
});
|
|
|
|
|
|
$categoryContainer.on('touchend', function(e) {
|
|
|
$categoryContainer.on('click', function(e) {
|
|
|
var $this = $(e.target),
|
|
|
$subLevel,
|
|
|
$cur, index;
|
...
|
...
|
@@ -59,6 +64,14 @@ $categoryContainer.on('touchend', function(e) { |
|
|
e.preventDefault();
|
|
|
}
|
|
|
|
|
|
if ($this[0] && $this[0].tagName === 'LI' && $this.find('a').attr('href')) {
|
|
|
location.href = $this.find('a').attr('href');
|
|
|
}
|
|
|
|
|
|
if ($this[0] && $this[0].tagName === 'A' && $this.attr('href')) {
|
|
|
location.href = $this.attr('href');
|
|
|
}
|
|
|
|
|
|
if ($cur.length > 0) {
|
|
|
index = $cur.index();
|
|
|
$subLevel = $this.closest('.content').find('.sub-level');
|
...
|
...
|
@@ -73,14 +86,6 @@ $categoryContainer.on('touchend', function(e) { |
|
|
$subLevel.not('.hide').addClass('hide');
|
|
|
$subLevel.eq(index).removeClass('hide');
|
|
|
}
|
|
|
|
|
|
if ($this[0] && $this[0].tagName === 'LI' && $this.find('a').attr('href')) {
|
|
|
location.href = $this.find('a').attr('href');
|
|
|
}
|
|
|
|
|
|
if ($this[0] && $this[0].tagName === 'A' && $this.attr('href')) {
|
|
|
location.href = $this.attr('href');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$categoryContainer.find('.primary-level').on('touchstart touchend touchcancel', 'li', function() {
|
...
|
...
|
|