鼠标输出时,二级导航会被跟踪几秒钟

时间:2016-02-16 18:59:52

标签: jquery css zurb-foundation zurb-foundation-6

我在我的网站上使用了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;}

1 个答案:

答案 0 :(得分:0)

mouseleave上的默认关闭时间为500毫秒,由closingTime对象的defaults属性定义,可通过DropdownMenu访问Foundation对象的功能。如果这是一口,下图描述了我的意思:

DropdownMenu defaults

您可以覆盖此值,但必须在调用$(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">

<强> Fiddle example