WordPress 菜单下拉

发布于 2024-11-04 06:56:54 字数 560 浏览 3 评论 0原文

好的,所以我到处都找过了,但找不到任何东西。我知道我可能需要一些jquery之类的东西。我曾尝试在 wordpress.org 上询问,但那是浪费时间,因为我已经 2-3 天没有回复,所以现在我会在这里询问。

  1. 我的目标是有一个主菜单,显示它所在的活动页面,并有一个用于其他菜单项的下拉菜单。我已经弄清楚了。

  2. 我的下一件事是当父级或子级处于活动状态时显示父级的子菜单。有点想通了。当父级处于活动状态时,子菜单将通过 css 进行显示。

  3. 接下来,当父级两个处于活动状态和/或父级两个的子级处于活动状态时,如果我将鼠标悬停在任何其他菜单项上(天气是否有子菜单),我希望它返回到正常样式。如果它有一个子菜单,那么我希望它显示在适当的位置,而不是父菜单两个。

我想要实现的目标但他们不使用任何其他页面上的导航菜单的一个很好的例子是 MSN 那里主导航(新闻、夹带等)是我正在寻找的内容,但希望父菜单和/或子菜单在活动时显示,但在将鼠标悬停在带或不带子菜单的其他菜单项上时消失。

Ok so i have looked everywhere and can not find anything. I know i might need some jquery or something. I have tried asking over at wordpress.org but that was a waste of time as i have had no replies for 2-3 days so now i will ask here.

  1. My goal is to have a main menu that shows the active page it is on and have a drop down for other menu items. I have that figured out.

  2. My next thing is to have the child menu of a parent shown when parent or child is active. Kind of have the figured out. The child menu displays but by css when parent is active.

  3. The next this when parent two is active and/or child of parent two is active i would like it to go back to normal style if i hover over any other menu item weather is has a child menu or not. If it has a child menu then i want it shown in place instead of parent two.

A somewhat good example of what i am trying to achieve but they dont use the nav menu on any other page is MSN there main nav (NEWS, Entrainment, etc.) is what i am looking for but want the parent and/or child menu shown if active but disappear when hovering over other menu items with or without child menu's.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

獨角戲 2024-11-11 06:56:54

因此,我在某种程度上找到了解决方案,但已经发布了关于我的其他问题的另一个问题,如果您认为您可以提供帮助,请访问此问题,但对于其他人,这是我的解决方案,

$(document).ready(function() {     
   $("see #1 below ").hover(function(){     
       $('see #2 below ').addClass(" see #3 below ");    
   },     
   function(){    
       $(' copy #2 ').removeClass("copy #3 ");     
    });
});
  1. 将您希望脚本激活的 id 或类放在这里
  2. ,将您希望脚本在此处添加类的 id 或类
  3. 将您希望脚本添加的类添加到 #2 列出的类或 id 中

您可以通过插入逗号来添加多个 id 或类(请参见下面的示例)
这是一个例子:

$(document).ready(function() {     
   $("#navbar li:hover, #navbar li.sfhover").hover(function(){     
       $('#navbar .current-menu-parent, #navbar li.current-menu-item').addClass("non-ahover");    
   },     
   function(){    
       $('#navbar li.current-menu-parent, #navbar li.current-menu-item').removeClass("non-ahover");     
    });
});

So i found the solution to some extent but have posted another question regarding my other issues if you think you can help then please visit this but for others here was my solution

$(document).ready(function() {     
   $("see #1 below ").hover(function(){     
       $('see #2 below ').addClass(" see #3 below ");    
   },     
   function(){    
       $(' copy #2 ').removeClass("copy #3 ");     
    });
});
  1. Put the id or class you want the script to be activated by here
  2. Put the id or class you want the script to add a class to here
  3. Put the class you want the script to add to the class or id listed for #2

you can add multiple id's or classes by inserting a comma (see example below)
here is an example:

$(document).ready(function() {     
   $("#navbar li:hover, #navbar li.sfhover").hover(function(){     
       $('#navbar .current-menu-parent, #navbar li.current-menu-item').addClass("non-ahover");    
   },     
   function(){    
       $('#navbar li.current-menu-parent, #navbar li.current-menu-item').removeClass("non-ahover");     
    });
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文