最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Dropdown submenu on bootstrap is not working - Stack Overflow

programmeradmin2浏览0评论

I just wanna ask why is it the dropdown submenu on bootstrap is not working, i just followed the instructions in this link: (.3.2/ponents.html) but still the dropdown sub menu on a submenu did not appear. By the way I did not change or override classes in the CSS.

Here's my code! :)

<li class='dropdown'><a class='dropdown-toggle active' data-toggle='dropdown' href='#'><img src = 'images/forbank.png' height = 35 width = 35>Banking<span class='caret'></span></a>
                <ul class='dropdown-menu'>
                    <li class = 'dropdown-submenu'><a tabindex='-1' href='#'><span class = 'glyphicon glyphicon-cog'> </span>  Transaction</a>
                        <ul class='dropdown-menu' role = 'menu'>
                            <li><a tabindex='-1' href='#'> Withdrawal / Deposit </a></li>
                            <li><a tabindex='-1' href='#'> Fixed Deposit </a></li>
                        </ul>
                    </li>
                    <li role='separator' class='divider'></li>
                    <li><a href='#'><span class='glyphicon glyphicon-list-alt'> </span> Summaries </a></li>
                    <li><a href='#'><span class='glyphicon glyphicon-wrench'> </span>  Settings </a></li>
                </ul>
            </li>

I just wanna ask why is it the dropdown submenu on bootstrap is not working, i just followed the instructions in this link: (http://getbootstrap./2.3.2/ponents.html) but still the dropdown sub menu on a submenu did not appear. By the way I did not change or override classes in the CSS.

Here's my code! :)

<li class='dropdown'><a class='dropdown-toggle active' data-toggle='dropdown' href='#'><img src = 'images/forbank.png' height = 35 width = 35>Banking<span class='caret'></span></a>
                <ul class='dropdown-menu'>
                    <li class = 'dropdown-submenu'><a tabindex='-1' href='#'><span class = 'glyphicon glyphicon-cog'> </span>  Transaction</a>
                        <ul class='dropdown-menu' role = 'menu'>
                            <li><a tabindex='-1' href='#'> Withdrawal / Deposit </a></li>
                            <li><a tabindex='-1' href='#'> Fixed Deposit </a></li>
                        </ul>
                    </li>
                    <li role='separator' class='divider'></li>
                    <li><a href='#'><span class='glyphicon glyphicon-list-alt'> </span> Summaries </a></li>
                    <li><a href='#'><span class='glyphicon glyphicon-wrench'> </span>  Settings </a></li>
                </ul>
            </li>
Share Improve this question edited Jul 6, 2015 at 4:50 chiragchavda.ks 5307 silver badges25 bronze badges asked Jul 6, 2015 at 0:59 Niel SinelNiel Sinel 2912 gold badges6 silver badges15 bronze badges 1
  • I would suggest using the newest version of Bootstrap. Version 2.3.2 is out of date, version 3.3.5 is the latest. getbootstrap./getting-started – bnahin Commented Jul 6, 2015 at 1:03
Add a ment  | 

2 Answers 2

Reset to default 12

Please verify if your the instructions you have followed corresponds to your bootstrap version.

Additionally, you can try to include this few lines of CSS to make things work.

.dropdown-submenu {
    position: relative;
}

.dropdown-submenu>.dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -6px;
    margin-left: -1px;
    -webkit-border-radius: 0 6px 6px 6px;
    -moz-border-radius: 0 6px 6px;
    border-radius: 0 6px 6px 6px;
}

.dropdown-submenu:hover>.dropdown-menu {
    display: block;
}

.dropdown-submenu>a:after {
    display: block;
    content: " ";
    float: right;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
    border-width: 5px 0 5px 5px;
    border-left-color: #ccc;
    margin-top: 5px;
    margin-right: -10px;
}

.dropdown-submenu:hover>a:after {
    border-left-color: #fff;
}

.dropdown-submenu.pull-left {
    float: none;
}

.dropdown-submenu.pull-left>.dropdown-menu {
    left: -100%;
    margin-left: 10px;
    -webkit-border-radius: 6px 0 6px 6px;
    -moz-border-radius: 6px 0 6px 6px;
    border-radius: 6px 0 6px 6px;
}

I did it, but the problem is the the submenu for "Withdrawal/Deposit" and "Fixed Deposit" is blocking the parent submenu "Transaction", it does not go to the right of it during hover. Here is my code now.

        <li class='dropdown'><a id = 'dLabel' class='dropdown-toggle active' data-toggle='dropdown' href='#'><img src = 'images/forbank.png' height = 35 width = 35>Banking<span class='caret'></span></a>
            <ul class='dropdown-menu multi-level' role='menu' aria-labelledby='dropdownMenu'>
                <li class = 'dropdown-submenu'>
                <a  tabindex = '-1' href='#'><span class = 'glyphicon glyphicon-cog'> </span>  Transaction </a>
                    <ul class='dropdown-menu'>
                        <li><a tabindex='-1' href='#'> Withdrawal / Deposit </a></li>
                        <li><a tabindex='-1' href='#'> Fixed Deposit </a></li>
                    </ul>
                </li>
                <li role='separator' class='divider'></li>
                <li><a href='#'><span class='glyphicon glyphicon-list-alt'> </span> Summaries </a></li>
                <li><a href='#'><span class='glyphicon glyphicon-wrench'> </span>  Settings </a></li>
            </ul>
        </li>
发布评论

评论列表(0)

  1. 暂无评论