Authored by ccbikai(👎🏻🍜)

分类页面优化

... ... @@ -16,15 +16,15 @@ module.exports = {
siteUrl: '//m.yohobuy.com',
assetUrl: '//localhost:5001',
domains: {
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/'
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/'
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/'
// favApi: 'http://192.168.102.31:8092/brower',
// api: 'http://192.168.102.205:8080/gateway/',
... ...
... ... @@ -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() {
... ...