Bootswatch dropdown in masterpage not working

2019-08-20 01:58发布

I am using Bootswatch (Journal theme). The dropdown items won't appear when one of the navigation bar options is selected.

In my directory 'Scripts\' I have the files - bootstrap-dropdown.js, bootstrap.min.js, dropdown.js, jquery-1.7.1.js, jquery-1.7.1.min.js

In my directory 'Styles\bootstrap\css\' I have the ff files - bootstrap-responsive.css, bootstrap-responsive.min.css, bootstrap.min.css

I think I am missing something I can't figured out. Thanks!

<title></title>

<link href="~/Styles/bootstrap/css/bootstrap.min.css" rel="Stylesheet" type="text/css" />
<link href="~/Styles/bootstrap/css/bootstrap-responsive.min.css" rel="Stylesheet" type="text/css" />


<asp:ContentPlaceHolder ID="HeadContent" runat="server">    
</asp:ContentPlaceHolder>

    <asp:HiddenField runat="server" ID="hfUsername"/>
    <div class="navbar">  
        <div class="navbar-inner">  
            <div class="container">  
                <ul class="nav">  
                    <a class="brand" href="#">WSTwitter</a>  
                    <li class="active"><a href="../User/Tweets.aspx">add a tweet</a></li>                      
                    <li class="dropdown" id="accountmenu">  
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">post company tweets<b class="caret"></b></a>                          
                    </li>  
                    <li class="dropdown" id="Li1">  
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">admin<b class="caret"></b></a>  
                        <ul class="dropdown-menu">  
                            <li><a href="../User/Account.aspx">Account</a></li>
                            <li><a href="../Admin/Users.aspx">Users</a></li>
                            <li><a href="../User/Clients.aspx">Clients</a></li>
                            <li><a href="../User/Links.aspx">Links</a></li>
                            <li><a href="#" onclick="window.open('../RSS.aspx?user='+document.getElementById('hfUsername').value,'_blank');">rss feed</a></li>
                            <%--  <li class="divider"></li>  --%>                            
                        </ul>  
                    </li>  
                    <li><a href="../Account/Logout.aspx">Logout</a></li>           
                </ul>  
            </div>  
        </div>  
    </div>  

    <div class="main">
        <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
    </div>

</form>

<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>  
<script src="@Url.Content("~/Scripts/bootstrap.min.js")" type="text/javascript"></script>    
<script src="@Url.Content("~/Scripts/bootstrap-dropdown.js")" type="text/javascript"></script>
 <script type="text/javascript">
     $(document).ready(function () {
         $('.dropdown-toggle').dropdown();
     });  
</script>  

1条回答
\"骚年 ilove
2楼-- · 2019-08-20 02:38

1 - if this "bootstrap-dropdown.js" is not your own code, you dont need this, because this code you can find in "bootstrap.min.js". And for css you just need this bootstrap-responsive.min.css, bootstrap.min.css, nothing more, just your own css.

2 - be sure this is load correctly:

<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>  
<script src="@Url.Content("~/Scripts/bootstrap.min.js")" type="text/javascript"></script>    
<script src="@Url.Content("~/Scripts/bootstrap-dropdown.js")" type="text/javascript"></script>

3 - try to use a newer jQuery file

i think the struture of your html code is correctly, i didnt see nothing wrong.

查看更多
登录 后发表回答