Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 引导模式不显示_Twitter Bootstrap_Modal Dialog - Fatal编程技术网

Twitter bootstrap 引导模式不显示

Twitter bootstrap 引导模式不显示,twitter-bootstrap,modal-dialog,Twitter Bootstrap,Modal Dialog,我复制并粘贴了twitter引导中的示例代码,在Rails 3.2应用程序中创建了一个基本模式窗口: <!-- Modal --> <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button t

我复制并粘贴了twitter引导中的示例代码,在Rails 3.2应用程序中创建了一个基本模式窗口:

<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Modal header</h3>
  </div>
  <div class="modal-body">
    <p>One fine body…</p>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <button class="btn btn-primary">Save changes</button>
  </div>
</div>

<a href= "#myModal"  role="button" class="btn" data-toggle="modal">Launch demo modal</a>
现在不知何故是div的一部分,因此在控制台中看起来如下所示:

<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;" >

但我不知道它为什么要加入,或者从哪里来。我怎样才能找到这个


谢谢,我找到了原因

我只是想让大家对这个问题有所了解。如果您无法找出问题所在,请尝试在应用程序中的任何样式表中“全部搜索”任何“模态”、“淡入”、“淡入”和“隐藏”类


我在一个随机css文件中定义了一个“淡入淡出”的实例,这就是它在覆盖引导时停止显示的原因。一旦我删除了引用,一切都正常。

如果您已从Bootstrap 2.3.2升级到Bootstrap 3,则需要从任何模式div中删除“hide”类

我的
  • 里有我的modal
    。。。。不太好

    室外工程罚款:-)

    
    &时代;
    ....
    

    取消 好啊
  • .....

  • 如果您正在使用angular并试图创建一个包含自定义模态的指令,模态背景将显示,但模态本身不会显示,除非您在指令上设置了replace:true

    Typescript指令:

    export class myModalDirective implements ng.IDirective {
        static Register = () => {
            angular.module('app').directive('myModal', () => { return new myModalDirective () });
        }
        templateUrl = 'mymodal.html'    
    restrict = 'E';
        replace = true;
        scope = {
            show: '='
        }
        link = (scope: any, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, ctrl: any) => {
            var vm = this;
            scope.$watch(function () { return scope.show; }, function (vis) {
                if (vis) {
                    $(element).modal('show');
                } else {
                    $(element).modal('hide');
                }
            });
    
        }
        constructor () {
        }
    }
    
    模态HTML

    <div class="modal fade" data-keyboard="false" data-backdrop="static">
        <div class="modal-dialog">
            <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title">Modal Title</h4>
                    </div>
                    <div class="modal-body">
                    </div>
            </div>
        </div>
    </div>
    
    
    情态标题
    
    我刚刚遇到这个问题,发现定制CSS样式表文本颜色:#ffffff正在淹没文本内容,因为模型背景颜色相同!i、 e..model content{background color:#ffffff;}确保通过添加以下内容在自定义样式表中覆盖它 .modal content{color:#6464!重要;}

    这可能会有所帮助。

    您应该导入jquery和bootstrap.min.js

    将此添加到angular cli:

    "scripts": ["../node_modules/jquery/dist/jquery.min.js",
            "../node_modules/bootstrap/dist/js/bootstrap.min.js"]
    

    确保你有它的文件夹。

    遇到这个问题后,我惊讶地发现这些解决方案都不起作用,因为它看起来相当简单,我在不同的页面上有类似的标记


    在我的配置中,我将现有jQuery代码绑定到触发模式的同一选择器。一旦开始消除过程,我所要做的就是在现有脚本中注释/删除
    e.stopPropagation()

    将您的代码更改为类似的内容,
    
    ×
    模态头
    一个好身体

    接近 保存更改
    启动演示模式
    我遇到了同样的问题,我意识到我的
    有一个
    type=“submit”
    当引导程序声明它需要是
    type=“button”
    时,我遇到了与Paula相同的问题,我的模式没有显示,我意识到我的按钮有一个“
    ”标签…:

    <button class="btn btn-danger" data-toggle="modal" data-target="#deleteItemModal">Delete</button>
    
    删除
    
    我刚刚用替换了