html - 模态无法正常工作?

标签 html css twitter-bootstrap

我一直在尝试用 jQuery 编写游戏代码,并且我已经掌握了大部分基础知识。

我目前正在处理 html 文件以配合它,但我收到代码错误,据我所知,没有明显的原因。

有人可以帮忙吗?

我正在使用位于此处的 Bootstrap :http://netdna.bootstrapcdn.com/bootswatch/3.1.1/superhero/bootstrap.min.css

我的代码在这里:

<!-- Modal -->
<div class="modal fade" id="onLoadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
             <h4 class="modal-title" id="myModalLabel">Welcome to Electronics: Evolution Duo!</h4>

        </div>
        <div class="modal-body">
            <p>You are on your way to become the next big electronics producer, but first you must name your store. How will people know what store to go to if it doesn't have a name?</p>
            <br />
            <p>It would also be wise to put your name on the deed to your store.</p>
             <h3>Name Your Store</h3>

            <input class="form-control" id="store" type="text">
             <h3>Name The Owner:</h3>

            <input class="form-control" id="owner" type="text">
        </div> // error on jsfiddle here
        <div class="modal-footer">
            <button type="button" id="modalClose" class="btn btn-success" data-dismiss="modal">Done</button>
        </div>
    </div> // and an error here
</div> 

我的 fiddle 在这里:http://jsfiddle.net/boundlessvagabond/cjN4E/6/

最佳答案

我添加了这个 Java 脚本行,它对我有用

    $('#onLoadModal').modal('show');

你可以看看http://jsbin.com/qobevoya/1/edit?html,js,outputhttp://jsfiddle.net/#&togetherjs=HvliL9wTPc 上的相同示例

PS:你忘了添加一个 Bootstrap javascript文件

关于html - 模态无法正常工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22416750/

相关文章:

css - 避免页面上出现多个滚动条的最佳方法是什么?

css - 从 Bootstrap 3 中的列中删除填充

javascript - jQuery css() 在 safari 中将 'transition-delay' 更改为 'transition'

css - 带有 Twitter Bootstrap 的全身背景

html - 向按钮添加图像叠加层

jquery - .selectpicker 不是一个函数

html - 无法摆脱 CSS 中的 div 换行符

html - 为什么网格没有形成?

html - CSS - 如何将页脚固定到页面底部

HTML 水平制表符。单击显示的选项卡时如何制作