Jquery CSS菜单下拉定位

Jquery CSS菜单下拉定位,jquery,css,navigation,Jquery,Css,Navigation,我正在建立一个导航栏,它将位于我正在开发的CMS的每个页面顶部。此导航栏包含一系列图像和文本链接,其中一些链接将触发下拉菜单 我对这个导航栏的几个部分有问题,看看这个提琴: 我无法使下拉菜单的右侧与菜单触发器的右侧对齐 当用户在菜单外单击并触发时,如何使菜单消失 [奖励!!!]加载预览帧时,您可以进行少量的左/右滚动。这在实际应用中是相同的。我怎样才能去掉它 很抱歉,我的问题太多了,但我现在有一个很大的障碍。有人能帮我解决这些问题吗 谢谢你抽出时间 下面的代码应该涵盖您的所有问题。只需将CSS规

我正在建立一个导航栏,它将位于我正在开发的CMS的每个页面顶部。此导航栏包含一系列图像和文本链接,其中一些链接将触发下拉菜单

我对这个导航栏的几个部分有问题,看看这个提琴:

  • 我无法使下拉菜单的右侧与菜单触发器的右侧对齐
  • 当用户在菜单外单击并触发时,如何使菜单消失
  • [奖励!!!]加载预览帧时,您可以进行少量的左/右滚动。这在实际应用中是相同的。我怎样才能去掉它
  • 很抱歉,我的问题太多了,但我现在有一个很大的障碍。有人能帮我解决这些问题吗


    谢谢你抽出时间

    下面的代码应该涵盖您的所有问题。只需将CSS规则和jQuery/JavaScript替换为以下代码即可。实例:

    CSS:

    nav.pluginBar ul.pluginBarRight li {
        display: inline-block;
        *display: inline; /* Invalid CSS, but necessary for IE7 to display each of the unordered list item in-line :( */
        zoom: 1; /* Invalid CSS again, but necessary for IE7 to treat the unordered list item as block-level elements :( */
        vertical-align : top;
        height: 35px;
        color: #999;
        clear: both;
        position: relative; /* Added this */
    }
    
    nav.pluginBar ul.pluginBarRight li div {
        background: #2d2d2d;
        width: 250px;
        position: absolute;
        right: 0; /* Added this */
        top: 35px;
        display: none;
    }
    
    $(function() {
        $(document).click(function () {
            $('.pluginBarRight li div').hide();
        });  
        $('.pluginBarRight li').click(function () {
            $('.pluginBarRight li div').hide();
            $(this).children('div').show();
            return false;
        });
    });
    
    jQuery:

    nav.pluginBar ul.pluginBarRight li {
        display: inline-block;
        *display: inline; /* Invalid CSS, but necessary for IE7 to display each of the unordered list item in-line :( */
        zoom: 1; /* Invalid CSS again, but necessary for IE7 to treat the unordered list item as block-level elements :( */
        vertical-align : top;
        height: 35px;
        color: #999;
        clear: both;
        position: relative; /* Added this */
    }
    
    nav.pluginBar ul.pluginBarRight li div {
        background: #2d2d2d;
        width: 250px;
        position: absolute;
        right: 0; /* Added this */
        top: 35px;
        display: none;
    }
    
    $(function() {
        $(document).click(function () {
            $('.pluginBarRight li div').hide();
        });  
        $('.pluginBarRight li').click(function () {
            $('.pluginBarRight li div').hide();
            $(this).children('div').show();
            return false;
        });
    });
    

    你看到我下面的解决方案了吗?哦,对不起。忘了接受!谢谢你完整的回答!