1

我正在为我的网站使用 Foundation 6。我的顶栏有问题。在鼠标悬停时出现第二级导航。但是,它需要几秒钟才能在鼠标移出时消失。它看起来像被跟踪了。

HTML:

<nav class="top-bar main-nav" id="top-bar-menu">
  <div class="row main-nav">
    <div class="top-bar-left">
      <ul class="vertical medium-horizontal menu menu-items" data-responsive-menu="accordion medium-dropdown">
        <li><a href="#">Item 1</a></li>
        <li><a href="#">Item 2</a>
          <ul class="menu vertical nested">
            <li><a href="#">Item 2A</a></li>
            <li><a href="#">Item 2B</a></li>
          </ul>
        </li>
        <li><a href="#">Item 3</a></li>
        <li><a href="#">Item 4</a></li>
      </ul>
    </div>  
  </div>
</nav>

CSS:

.top-bar, .top-bar ul {background-color: #8d3895; padding-top: 0; padding-bottom: 0;}

nav.main-nav .dropdown.menu .is-dropdown-submenu-parent.is-right-arrow > a::after {border-style: none;}

nav.main-nav .dropdown.menu .is-dropdown-submenu-parent a::after { 
  margin-left: 0;}

nav.main-nav .dropdown.menu .is-dropdown-submenu-parent ul {margin-left:0;
  border-top:0; margin-top: 0; padding-left: 0; padding-right: 0; background: #fce2d1;}

.dropdown.menu .submenu {min-width: 100%;}

nav.main-nav .is-submenu-item.is-dropdown-submenu-item {padding-right: 0;}

nav.main-nav.top-bar {padding:0; background-color: #8d3895;}

nav div.top-bar-left {width: 95%;}

nav.main-nav.top-bar ul li {
  text-align: center;} 

.menu > li:not(.menu-text) > a {
  display: block;
  line-height: 1;
  padding: 0.7rem 0;}

nav.main-nav.top-bar ul li a {
  font-family: Source Sans Pro;
  font-size: 1.35em;
  color: #ffffff;
  padding-right: 0.75em;}

nav.main-nav.top-bar ul li a:hover {
  font-size: 1.35em;
  color: #4a8ac9;
  background-color: #ffffff;
  width: inherit;} 

nav.main-nav.top-bar ul li ul li a:hover {
  font-size: 1.35em;
  color: #333333;
  background: #f68b1f;
  width: inherit;}

/*Submenu items*/
nav.main-nav.top-bar .is-active a {
  background-color: #ffffff;
  color: #4a8ac9;}

div.search-bar {padding: 1em 0;}

.top-bar input {width: auto!important;}
4

1 回答 1

0

默认关闭时间mouseleave500毫秒,由对象的closingTime属性定义defaults,可以通过对象的DropdownMenu函数访问Foundation。如果那是一口,下图描述了我的意思:

下拉菜单默认值

您可以覆盖此值,但必须在调用$(document).foundation();. 此更改将应用​​于所有下拉菜单,除非您使用data-closing-time属性明确覆盖该行为:

Foundation.DropdownMenu.defaults.closingTime = 0;
$(document).foundation();

data-closing-time使用属性的示例:

<ul class="vertical medium-horizontal menu menu-items" data-closing-time="0" data-responsive-menu="accordion medium-dropdown">

小提琴示例

于 2016-02-16T21:14:53.210 回答