【问题标题】:Hovering menu doesnt resizing悬停菜单不调整大小
【发布时间】:2014-02-24 20:14:44
【问题描述】:

我有一个菜单和一个子菜单,它们只会在鼠标悬停时显示。但我无法调整它的大小。

这是我的 javascript:

$('#menu li').hover(function() {
        $(this).find('ul').show();
    },
    function() {
      $(this).find('ul').hide();
});

HTML 部分:

      <ul id='menu'>

        <li>
           <a href="#"class="current">Marketing</a>
               <ul style="display:none; border-bottom-color:#F00;">
                  <li style="margin:-350px 294px 0px">
                      <a href="#" >ForSale</a>                     
                  </ul>
               </li>
       <!-- <li></li>-->
      </ul>
    </nav>
</header>

Demo is here.

谢谢。

【问题讨论】:

  • 你想达到什么目的?
  • 子菜单未调整大小。我需要调整子菜单的大小以使男士的宽度和高度发生变化
  • 先看看你的 html.. 不正确.. 之后将其设置为父级最大尺寸的 100%
  • 请看我的小提琴..jsfiddle.net/manojmcet/wfXZ4/1/.full 代码在这里可用。
  • 如果要更改子菜单的宽度和高度,请在 CSS 中定义相同的类,例如 .submenu{ width: xx;身高:xx;}

标签: javascript html css


【解决方案1】:

我在这里做了一些改变

  <ul class="submenu" style="width:60px; display:none; border-bottom-color:#F00;"><li style="margin:-328px 294px 0px"><a href="http://localhost/new_vinu_sir/Marketing.html" >ForSale</a>                     
                                    </ul></li>

然后放css

.submenu li a
{ 
    width:100px;
    height:50px;
}

现在子菜单已调整大小。您可以根据需要调整大小。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-29
    • 2017-03-09
    • 1970-01-01
    • 1970-01-01
    • 2014-04-03
    • 2014-12-17
    • 1970-01-01
    • 2022-10-15
    相关资源
    最近更新 更多