Bootstrap dropdown not working

前端 未结 24 1006
孤城傲影
孤城傲影 2020-12-07 18:05

I can\'t make bootstrap dropdown to work. Here is my html for nav:

  • Home
相关标签:
24条回答
  • 2020-12-07 18:47

    Here what i did is .....

    Just removed bootstrap.min.js from my Project and added bootstrap.js to it and it started working........

    bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js"
                      //"~/Scripts/bootstrap.min.js"));
    
    0 讨论(0)
  • 2020-12-07 18:48

    I had the same problem. After a couple of hours of trouble shooting found that,

    I had

    <script type="text/javascript" src="Scripts/bootstrap.min.js"></script>
    <script type="text/javascript" src="Scripts/jquery-2.1.1.min.js"></script>
    

    instead of,

    <script type="text/javascript" src="Scripts/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="Scripts/bootstrap.min.js"></script>
    

    Hope this helps someone

    0 讨论(0)
  • 2020-12-07 18:48

    I had a similar issue only to observe that i had added the bootstrap script twice and the second bootstrap script was after above the jquery script.

    Solution:

    • Ensure that bootstrap.min.js and jquery.min.js are only included once in your file.
    • The bootstrap.min.js script should be included after jquery.min.js
    0 讨论(0)
  • 2020-12-07 18:48

    For latest Bootstrap you will need Popper.js

    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
    

    Copy the link in the End of the Body section just before the <body> Tag, inside <Head> Tag.

    0 讨论(0)
  • 2020-12-07 18:51

    I just added JS part of bootstrap to my index page, then it worked

    Paste this, if you're using the latest version of bootstrap

    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
    
    0 讨论(0)
  • 2020-12-07 18:53

    For your style you need to include the css files of bootstrap, generally just before </head> element

    <link href="css/bootstrap.css" rel="stylesheet">    
    

    Next you'll need to include the js files, it's recommended to include them at the end of the document, generally before the </body> so pages load faster.

    <script src="js/jquery.js"></script>        
    <script src="js/bootstrap.js"></script>
    
    0 讨论(0)
提交回复
热议问题