...
|
...
|
@@ -4,19 +4,24 @@ |
|
|
* @date: 2015/10/14
|
|
|
*/
|
|
|
|
|
|
var $ = require('jquery');
|
|
|
var $ = require('jquery'),
|
|
|
Hammer = require('hammer');
|
|
|
|
|
|
var $nav = $('.category-nav'),
|
|
|
$contents = $('.category-container > .content');
|
|
|
$categoryContainer = $('.category-container'),
|
|
|
$contents = $categoryContainer.children('.content');
|
|
|
|
|
|
var $curContent = $contents.not('.hide');
|
|
|
|
|
|
var navHammer, ccHammer;
|
|
|
|
|
|
$('#search-input').focus(function() {
|
|
|
$(this).blur();
|
|
|
});
|
|
|
|
|
|
$nav.delegate('li', 'tap', function() {
|
|
|
var $this = $(this),
|
|
|
navHammer = new Hammer($nav[0]);
|
|
|
navHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target).closest('li'),
|
|
|
index = $this.index();
|
|
|
|
|
|
if ($this.hasClass('focus')) {
|
...
|
...
|
@@ -30,19 +35,25 @@ $nav.delegate('li', 'tap', function() { |
|
|
$curContent = $contents.eq(index).removeClass('hide');
|
|
|
});
|
|
|
|
|
|
$('.primary-level').delegate('li', 'tap', function() {
|
|
|
var $this = $(this),
|
|
|
index = $this.index();
|
|
|
ccHammer = new Hammer($categoryContainer[0]);
|
|
|
ccHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target),
|
|
|
$subLevel,
|
|
|
$cur, index;
|
|
|
|
|
|
var $subLevel = $this.closest('.content').find('.sub-level');
|
|
|
$cur = $this.closest('.p-level-item');
|
|
|
if ($cur.length > 0) {
|
|
|
index = $cur.index();
|
|
|
$subLevel = $this.closest('.content').find('.sub-level');
|
|
|
|
|
|
if ($this.hasClass('focus')) {
|
|
|
return;
|
|
|
}
|
|
|
if ($this.hasClass('focus')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$this.closest('.primary-level').children('.focus').removeClass('focus');
|
|
|
$this.addClass('focus');
|
|
|
$this.closest('.primary-level').children('.focus').removeClass('focus');
|
|
|
$this.addClass('focus');
|
|
|
|
|
|
$subLevel.not('.hide').addClass('hide');
|
|
|
$subLevel.eq(index).removeClass('hide');
|
|
|
$subLevel.not('.hide').addClass('hide');
|
|
|
$subLevel.eq(index).removeClass('hide');
|
|
|
}
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|