我希望将以下条件添加到我现有的页面中。顺便说一句,目前一切看起来都很好,在这里可以看到:http://www.ceramictilepro.com/Ceramic-Tile-And-Grout-Tips.php。
1)当单击上述链接时,页面将有一个垂直菜单/子菜单,其中只有菜单是可见的(当前所有菜单/子菜单都已展开)。
2)当单击所选菜单时,将展开子菜单并使其可见(目前在此不做任何更改)。
3)单击子菜单后,将打开新页。(目前也是这样)
4)这里是我需要帮助的地方,我希望新页面关闭所有其他菜单,但单击所选子菜单的菜单除外。
注:选定的链接高亮显示红色背景,以便于导航。(情况保持不变,这里不需要改变)
这是小提琴
下面是当前工作的jQuery
$.each([1, 2, 3, 4, 5], function (index) {
$(".toggle" + index).click(function () {
$(".submenu" + index).slideToggle("fast", function () {
// Animation complete.
});
});
});
$(function () {
$('a').each(function () {
if ($(this).prop('href') == window.location.href) {
$(this).addClass('_current_highlight_button');
}
});
});
$(function () {
var split = window.location.pathname.split('/');
var mnurl = split[split.length - 1];
mnurl = '#';
$(' a[href="' + mnurl + '"]').addClass("_current_highlight_button");
}); // mnurl='.php goes here';(谢谢你的建议:)
发布于 2013-10-15 01:32:12
更新
$(function () {
var selected;
$('.vmenu li a').click(function(e){
$('.vmenu ul').not($(this).parent().next('ul')).css('display','none');
});
$('a').each(function () {
if ($(this).prop('href') == window.location.href) {
$(this).addClass('_current_highlight_button');
selected = $(this).parent().parent();
}
});
$('.vmenu ul').not(selected).css('display','none');
});https://stackoverflow.com/questions/19371824
复制相似问题