jQuery.noConflict();
jQuery(document).ready(function ($) {
var $oe_menu = $('#oe_menu');
var $oe_menu_items = $oe_menu.children('li');
$oe_menu_items.bind('mouseenter', function () {
var $this = $(this);
$this.addClass('selected');
$this.children('div').css('z-index', '9999').stop(true, true).slideDown(300, function () {
$(this).parent().not('.selected').children('div').hide();
});
}).bind('mouseleave', function () {
$(this).children('div').hide();
var $this = $(this);
$this.removeClass('selected').children('div').css('z-index', '1');
}).bind('click', function () {
$(this).children('div').hide();
var $this = $(this);
// if (window.mobilecheck()) {
$this.removeClass('selected').children('div').css('z-index', '1');
// }
});
$oe_menu.bind('mouseenter', function () {
var $this = $(this);
$this.addClass('hovered');
}).bind('mouseleave', function () {
var $this = $(this);
$this.removeClass('hovered');
$this.children('div').hide();
}).bind('click', function () {
// if (window.mobilecheck()) {
var $this = $(this);
$this.removeClass('hovered');
$this.children('div').hide();
// }
});
if ($('.grid-categories-megamenu').parent().parent()) {
$('.grid-categories-megamenu').parent().parent().mouseenter(function () {
height1 = $(this).attr('id');
var max_height_title = 0;
$.each($('#' + height1 + ' .level1-title'), function (key, e) {
if (max_height_title < $(this).height()) {
max_height_title = $(this).height();
}
});
$('#' + height1 + ' .level1-title').height(max_height_title);
var max_height1 = 0;
$.each($('#' + height1 + ' .level1-megamenu'), function (key, e) {
if (max_height1 < $(this).height()) {
max_height1 = $(this).height();
}
});
$('#' + height1 + ' .level1-megamenu').height(max_height1);
});
}
if ($('.list-categories-megamenu').parent().parent()) {
$('.list-categories-megamenu').parent().parent().mouseenter(function () {
height2 = $(this).attr('id');
var max_height2 = 0;
$.each($('#' + height2 + ' .level1-megamenu'), function (key, e) {
if (max_height2 < $(this).height()) {
max_height2 = $(this).height();
}
});
$('#' + height2 + ' .level1-megamenu').height(max_height2);
});
}
if ($('.group-category').parent().parent().parent()) {
$('.group-category').parent().parent().parent().mouseenter(function () {
height3 = $(this).attr('id');
var max_height3 = 0;
$.each($('#' + height3 + ' .level1-megamenu'), function () {
if (max_height3 < $(this).height()) {
max_height3 = $(this).height();
}
});
$('#' + height3 + ' .level1-megamenu').height(max_height3);
});
}
if ($('.products-megamenu-grid').parent().parent()) {
$('.products-megamenu-grid').parent().parent().mouseenter(function () {
height4 = $(this).attr('id');
var max_height_name = 0;
$.each($('#' + height4 + ' .product-name'), function (key, e) {
if (max_height_name < $(this).height()) {
max_height_name = $(this).height();
}
});
$('#' + height4 + ' .product-name').height(max_height_name);
});
}
});
上面的脚本用于控制magento网站的megamenu。在手机视图中,我需要能够单击打开菜单,然后单击以关闭它。如果可能的话,我可以用加号隐藏子类别吗?请adivce。