Commit 586de5a4 by 王东红

优化手机版导航条点击

parent c94ef96d
......@@ -75,6 +75,8 @@ define([
},
"click .ui-menu-item:has(a)": function (event) {
var target = $(event.target).closest(".ui-menu-item");
this.active = null
if (!this.mouseHandled && target.not(".ui-state-disabled").length) {
this.select(event);
......@@ -618,7 +620,8 @@ define([
// point, but the tests don't trigger mouseenter before click.
this.active = this.active || $(event.target).closest(".ui-menu-item");
var ui = {item: this.active};
if (!this.active.has(".ui-menu").length) {
if (!this.active.children().children().has(".ui-menu").length) {
this.collapseAll(event, true);
}
this._trigger("select", event, ui);
......
......@@ -480,19 +480,19 @@ define([
$.each(subMenus, $.proxy(function (index, item) {
var category = $(item).find('> a span').not('.ui-menu-icon').text(),
categoryUrl = $(item).find('> a').attr('href'),
menu = $(item).find('> .ui-menu');
menu = $(item).children().children().find('> .ui-menu');
this.categoryLink = $('<a>')
.attr('href', categoryUrl)
.text($.mage.__('All %1').replace('%1', category));
this.categoryParent = $('<li>')
.addClass('ui-menu-item all-category')
.html(this.categoryLink);
if (menu.find('.all-category').length === 0) {
menu.prepend(this.categoryParent);
}
// this.categoryParent = $('<li>')
// .addClass('ui-menu-item all-category')
// .html(this.categoryLink);
//
// if (menu.find('.all-category').length === 0) {
// menu.prepend(this.categoryParent);
// }
}, this));
},
......@@ -726,8 +726,7 @@ define([
ui = {
item: this.active
};
if (!this.active.has('.ui-menu').length) {
if (!this.active.children().children().has('.ui-menu').length) {
this.collapseAll(event, true);
}
this._trigger('select', event, ui);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment