简体   繁体   English

在向下导航菜单上实现圆角

[英]Implementing rounded corners on slide down navigation menu

I am working on the slide down menu you can see here . 我正在使用下拉菜单,您可以在这里看到。 I have rounded corners on both ul#navigation and ul.subnavigation . 我在ul#navigationul.subnavigation When the submenu slides down it is possible to see the border at the bottom of ul.subnavigation overlap with the content of ul#navigation , when I would like it to slide down smoothly, without the 'flicker'. 当子菜单向下滑动时,可以看到ul.subnavigation底部的ul.subnavigationul#navigation的内容重叠,当我希望它平滑向下滑动时,不会出现“闪烁”的情况。 I am aware that this issue is caused by the rounded corners. 我知道此问题是由圆角引起的。 I need ul.subnavigation to cover the rounded corners at the bottom of ul#navigation when the menu drops down, without seeing the double border-bottom issue. 当菜单下拉时,我需要ul.subnavigation覆盖ul#navigation底部的圆角,而不会看到双重底边框问题。 I hope this is clear! 我希望这很清楚! Code is below. 代码如下。

Thanks, 谢谢,

Nick 缺口

HTML 的HTML

<ul id="navigation">
    <li class="dropdown"><a href="#">menu</a>
        <ul class="sub_navigation">
            <li><a href="#">home</a></li>
            <li><a href="#">help</a></li>
            <li><a href="#">disable tips</a></li>
        </ul>
    </li>
</ul>

JQUERY JQUERY

$('.dropdown').hover(function() {
    $(this).find('.sub_navigation').slideToggle();
});​

CSS 的CSS

ul#navigation, ul.sub_navigation {
    margin:0;
    padding:0;
    list-style-type:none;
    min-width:100px;
    background-color: white;
    font-size:15px;
    font-family: Trebuchet MS;
    text-align: center;
    -khtml-border-radius: 0 0 5px 5px;    
    -moz-border-radius: 0 0 5px 5px;
    -webkit-border-radius: 0 0 5px 5px;
    border-radius: 0 0 5px 5px;
    border:1px black solid;
    border-top:none;
}

ul.sub_navigation {
    margin-left:-1px;
    position: absolute;
    top:28px;
}

ul#navigation {
    float:left;
    position:absolute;
    top:0;
}

ul#navigation li {
    float:left;
    min-width:100px;
}

ul.sub_navigation {
    position:absolute;
    display:none;
}

ul.sub_navigation li {
    clear:both;
}

 a,
 a:active,
 a:visited {
    display:block;
    padding:7px;
}

Why position the submenu? 为什么要定位子菜单? Remove the positioning on it and just hide it till hover triggers. 移开它的位置,然后隐藏它,直到悬停触发为止。

Check this fiddle . 检查这个小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM