zoukankan      html  css  js  c++  java
  • 初次bootstrap创建下拉菜单的问题

    今天使用了bootstrap框架创建导航栏的下拉菜单,但试了多次没有效果,检查代码也没问题。最终通过百度了解到需要引入jquery,Bootstrap插件是jquery插件,依赖于jquery。

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>bootstrap test</title>
        <link href="css/bootstrap.css" rel="stylesheet" />
        <script type="text/javascript" src="http://www.see-source.com/bootstrap/js/jquery.js"></script>
        <script src="js/bootstrap.js"></script>
    
    
        </script>
    </head>
    <body>
        <ul class="nav nav-tabs" >
            <li class="active"><a  href="#">首页</a></li>
            <li><a href="#">热点</a></li>
            <li class="dropdown "  >
                <a class="dropdown-toggle" data-toggle="dropdown" href="#">新闻<b class="caret"></b></a>
                <ul class="dropdown-menu" >
                    <li><a tabindex="-1" href="#">zhazha</a></li>
                    <li><a tabindex="-1" href="#">nima</a></li>
                </ul>
            </li>
            
        </ul>
    </body>
    

      仅仅是短了这样一句引用(下载了jQuery库文件,然后引用)。bootstrap的jQuery必须引用在这句之后。

      <script type="text/javascript" src="../js/jquery.js"></script>
  • 相关阅读:
    react 踩坑第一天
    vue-cli+axios+跨域
    vuex 进阶 mapState mapGetter mapActions mapMutations
    vue Bus
    各种html布局
    echarts柱状图设置渐变色
    html设置一个当前时间
    css设置字体渐变色
    C++中指针与引用详解
    go-admin 开源后台管理系统
  • 原文地址:https://www.cnblogs.com/lpynb/p/3667547.html
Copyright © 2011-2022 走看看