【问题标题】:Bootstrap's Modal Does Not FadeBootstrap 的 Modal 不褪色
【发布时间】:2017-07-23 07:58:19
【问题描述】:

我正在尝试使用 Bootstrap v3.3.4 制作模式。当我使用“modal fade”类并单击标签时它不会出现,但是当我在“modal in”中写入时它会出现。我希望模态在单击时淡入和淡出。有什么我应该研究的想法或文件吗?

head
    link(rel='stylesheet', href='/stylesheets/bootstrap.min.css')
body
    a(href='#', data-toggle='modal', role='button', data-target='#modalPassword') Change Password
    div(id='modalPassword', class='modal fade', tabindex='-1', role='dialog')
        div(class='modal-dialog')
            div(class='modal-content')
                div(class='modal-header')
                    button(type='button', class='close', data-dismiss='modal')×
                    h4(class='modal-title') Change Password

这是我知道我的模态正常工作的代码:

body
    a(href='#', data-toggle='modal', role='button', data-target='#modalPassword') Change Password
    div(id='modalPassword', class='modal in', tabindex='-1', role='dialog')
        // More code here

还有我个人的 CSS:

.modal.in{
    display: block;
}

【问题讨论】:

    标签: pug bootstrap-modal


    【解决方案1】:

    确保标签的空格和button×之间的空格

    button(type='button', class='close', data-dismiss='modal') ×

    添加此更改后,代码可以正常工作

    html 
        head
            title
            link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css')
        body
    
            a(href='#', data-toggle='modal', role='button', data-target='#modalPassword') Change Password
            div(id='modalPassword', class='modal fade', tabindex='-1', role='dialog')
                div(class='modal-dialog')
                    div(class='modal-content')
                        div(class='modal-header')
                            button(type='button', class='close', data-dismiss='modal') ×
                            h4(class='modal-title') Change Password
            script(type='text/javascript', src='https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js')
            script(type='text/javascript', src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js')
    

    【讨论】:

    • 感谢您的帮助;它现在可以正常工作。我所缺少的只是底部的两个脚本。
    猜你喜欢
    • 2023-04-04
    • 1970-01-01
    • 2019-07-02
    • 1970-01-01
    • 2017-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-03
    相关资源
    最近更新 更多