【问题标题】:Superfish second level ul very tinySuperfish 二级 ul 非常小
【发布时间】:2014-02-18 23:22:46
【问题描述】:

问题是我网站上的超级鱼菜单: http://alexander-pastor.de/

当鼠标悬停在顶层ul的li上时,子ul只有16px的高度。我无法以某种方式修复它。向 ul 或 li 添加 height/min-height css-property 似乎不起作用。

我通过 jQuery 将 sf-menu 类添加到 ul,因为它是来自 contao-module 的自动生成代码。它由导航元素包裹。像这样:

<nav class="mod_navigation block">
    <ul class="level_1 sf-menu">
        <li>
           <ul>...
        </li>
        ... ...
        ... ...
     </ul>
 </nav>

如果有人可以调查一下,我将不胜感激:D

我正在使用最新版本的超级鱼。 我在 head-tag 中包含以下内容:

<script type="text/javascript">


    $(document).ready( function() {
        $('#header-navigation ul.level_1').addClass('sf-menu');
    });

    $(document).ready(function(){

        // initialise plugin
        var example = $('#header-navigation ul.level_1').superfish({});

    });

</script>

<script type="text/javascript" src="files/version9/plugins/superfish/superfish.js">       </script>
<script type="text/javascript" src="files/version9/plugins/superfish/hoverIntent.js"></script>

superfish.css 包含:

.sf-menu, .sf-menu * {
    margin: 0;
    padding: 0;
    list-style: none;
}
.sf-menu li {
    position: relative;
    min-height:40px;/*cust*/
    line-height:1.0;
}
.sf-menu ul {
    position: absolute;
    display: none;
    top: 100%;
    left: 0;
    z-index: 10000;
}
.sf-menu > li {
    float: left;
}
.sf-menu li:hover > ul,
.sf-menu li.sfHover > ul {
    display: block;
}

.sf-menu li:hover > ul,/*cust*/
.sf-menu li.sfHover > ul  li{
    display: block;
    min-height:40px;
    line-height:1.0;
}

.sf-menu a, .sf-menu span {
    display: block;
    position: relative;
    padding:12px 16px;
}


.sf-menu {
    float: left;
    margin-bottom: 1em;
    -webkit-border-bottom-right-radius: 5px;
    -webkit-border-bottom-left-radius: 5px;
    -moz-border-radius-bottomright: 5px;
    -moz-border-radius-bottomleft: 5px;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
}
.sf-menu ul {
    box-shadow: 2px 2px 6px rgba(0,0,0,.2);
    min-width: 12em; /* allow long menu items to determine submenu width */
    *width: 12em; /* no auto sub width for IE7, see white-space comment below */
}

.sf-menu a {
    color: #13a;
}
.sf-menu li {
    background:     rgb(16, 16, 16);
    background:     rgba(16, 16, 16, 1);
    white-space: nowrap; /* no need for Supersubs plugin */
    *white-space: normal; /* ...unless you support IE7 (let it wrap) */
    -webkit-transition: background .2s;
    transition: background .2s;
}
.sf-menu ul li {
    background:     rgb(60, 60, 60);
    background:     rgba(60, 60, 60, 0.8);
}
.sf-menu li.first{
    -webkit-border-bottom-left-radius: 5px;
    -moz-border-radius-bottomleft: 5px;
    border-bottom-left-radius: 5px;
}
.sf-menu ul ul li {
    background:     rgb(51, 51, 51);
    background:     rgba(51, 51, 51, 0.8);
    height:40px;
}
.sf-menu ul ul ul li {
    background:     rgb(34, 34, 34);
    background:     rgba(34, 34, 34, 0.8);
}
.sf-menu li:hover, .sf-menu li.sfHover,
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
    background:rgb(40,40,40);
    outline:0;
    text-shadow:
    -1px -1px 3px #fff,
    -1px -1px 4px #fff;
    text-decoration:none;
}

.sf-menu li:hover,
.sf-menu li.sfHover {
    background:     rgb(40, 40, 40);
    background:     rgba(40, 40, 40, 0.8);
    /* only transition out, not in */
    -webkit-transition: none;
    transition: none;
}

/*** arrows (for all except IE7) **/
.sf-arrows .sf-with-ul {
    padding-right: 2.5em;
    *padding-right: 1em; /* no CSS arrows for IE7 (lack pseudo-elements) */
}
/* styling for both css and generated arrows */
.sf-arrows .sf-with-ul:after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1em;
    margin-top: -3px;
    height: 0;
    width: 0;
    /* order of following 3 rules important for fallbacks to work */
    border: 5px solid transparent;
    border-top-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
    border-top-color: rgba(255,255,255,.5);
}
.sf-arrows > li > .sf-with-ul:focus:after,
.sf-arrows > li:hover > .sf-with-ul:after,
.sf-arrows > .sfHover > .sf-with-ul:after {
    border-top-color: white; /* IE8 fallback colour */
}
/* styling for right-facing arrows */
.sf-arrows ul .sf-with-ul:after {
    margin-top: -5px;
    margin-right: -3px;
    border-color: transparent;
    border-left-color: #dFeEFF; /* edit this to suit design (no rgba in IE8) */
    border-left-color: rgba(255,255,255,.5);
}
.sf-arrows ul li > .sf-with-ul:focus:after,
.sf-arrows ul li:hover > .sf-with-ul:after,
.sf-arrows ul .sfHover > .sf-with-ul:after {
    border-left-color: white;
}

应该不会和我的default.css冲突吧?!

default.css - 包含 #header** 的部分

#header {
    border-radius:...;

    color:#fff;
}

#header a{
    color:#fff;
    text-decoration:none;
}

#header-menu{
    width:1000px;
    height:46px;

    background: ...;

    text-align: center;

    border-radius...
}

#header-menu-elements{
    margin:5px 0;
}

#header-menu-elements{
    height:36px;
    float:left;
    background:transparent;
}

#header-navigation{
    height:40px;
    background:...;
    border-radius:...;
}

【问题讨论】:

    标签: html css superfish contao


    【解决方案1】:

    这不是因为 height 属性。您的.block 有一个overflow: hidden;(也位于您的nav),这会导致您的子导航的主要部分不可见。

    【讨论】:

    • 谢谢,经过更多的调整,它就可以完美运行了! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-12-04
    • 1970-01-01
    • 2016-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多