如何让twitter bootstrap模式在节点js表达js?

时间:2012-07-12 15:51:47

标签: node.js twitter-bootstrap express

这是我的index.jade文件

.navbar.navbar-fixed-top
    .navbar-inner
        .container
            .brand #{title}

    .container
        .row
            .hero-unit
                h1 #{title}
                p Cricket fantasy game where you can be selector.
                a.btn(data-toggle="modal", href="#myModal") Launch


div.modal.hide(id="myModal")
    .modal-header
        button(type="button", class="close", data-dismiss="modal") x
        h3 Modal Header
    .modal-body
        p One fine body...
    .modal-footer

这是我的layout.jade文件

!!!
html
    head
        title= title
        link(rel='stylesheet', href='/libs/bootstrap/css/bootstrap.css')
        link(rel='stylesheet', href='/libs/bootstrap/css/bootstrap.min.css')
        link(rel='stylesheet', href='/libs/bootstrap/css/bootstrap-responsive.min.css')
        link(rel='stylesheet', href='/stylesheets/style.css')
    body!= body
script(src="/libs/bootstrap/js/bootstrap.js")

我有其他引导元素正常工作,但不能按照以下说明操作 - “您可以轻松激活页面上的模态而无需编写一行javascript。只需在控制器元素上设置data-toggle =”modal“ data-target =“#foo”或href =“#foo”,它对应一个模态元素id,点击后,它将启动你的模态。“

我该怎么做?

2 个答案:

答案 0 :(得分:1)

在layout.jade文件中包含jquery lib

答案 1 :(得分:0)

在bootstrap之前添加jQuery:

script(src="https://code.jquery.com/jquery-3.2.1.min.js")