javascript - Twitter Bootstrap 模态不出现

标签 javascript jquery html twitter-bootstrap modal-dialog

我使用 Twitter Bootstrap 创建的任何模式都无法显示。看到我使用 bootstrap 提供的代码设置了一个测试模式,但它仍然不起作用,我不确定我做错了什么。

这是我的代码(仅正文): 您需要链接到 bootstrap.js、bootstrap-modal.js、jquery.js 和 bootstrap.css

<body>
    <div class="modal hide" id="myModal">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">
                &times;
            </button>
            <h3>Modal header</h3>
        </div>
        <div class="modal-body">
            <p>
                Modal body would go here...
            </p>
        </div>
        <div class="modal-footer">
            <a href="#" class="btn" data-dismiss="modal">Close</a>
            <a href="#" class="btn btn-primary">Save changes</a>
        </div>
    </div>

    <a data-toggle="modal" href="#myModal">Show Modal</a>
</body>

这里是 Bootstrap 包和 Bootstrap 模式所需的 jquery 的链接: bootstrap package jquery

最佳答案

我的问题是我同时包含了 boostrap.js 和 bootstrap-modal.js。显然,如果你包含 bootstrap.js,你不应该也包含 bootstrap-modal.js,因为 boostrap.js 导入了它兼容的所有 javascript 插件。像那样的东西。删除我的 boostrap-modal.js 脚本链接后它起作用了。

关于javascript - Twitter Bootstrap 模态不出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11488426/

相关文章:

javascript - 在 Ajax jQuery/Javascript 中使用参数

javascript - 是否可以在 Visual Studio 中突出显示某些代码行?

javascript - 将选定的行传输到另一个表

javascript - <a> 和 <button> 用于创建链接时有性能差异吗?

javascript - 尝试传入回调函数失败

javascript - 模态窗口加载动态内容并及时更改

php - Sublime Text 2 到 MySQL 数据库连接不起作用

javascript - 提交前验证 "select"下拉列表

php - 使用 php、Jquery 的聊天应用程序

javascript - 悬停时显示div