全球导航下拉列表

时间:2018-04-16 05:11:00

标签: javascript navigation

我一直在搜索,但不确定这是否可行。是否可以仅在全局导航中为第二个元素创建一个悬停在下拉列表中?这就是我在js文件中的内容,并希望第二个元素下拉,我会在那里再添加两个项目。



document.getElementById("myNav").innerHTML =
    "<ul id='nav navbar-nav' class='nav navbar-nav'>"
    + "<li><a href='https://home.com/'>Home</a></li>"
    + "<li><a href='https://gear.com'>Gear Reviews</a></li>"
    + "<li><a href='https://articles.com'>Articles</a></li>"
    + "<li><a href='https://calculator.com'>Volume Calculator</a></li>"
     "</ul>";
&#13;
 <html>
 <!-- Navigation -->
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <nav id="myNav">
                         <script src="js/load_essentials_gear.js"></script>
                    </nav>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
            
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案