Bootstrap   发布时间:2022-04-18  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了twitter-bootstrap – Bootstrap模式不会出现在Meteor中大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正试图让Bootsrap的模态工作,但是当我点击按钮时,我得到的是一个黑屏,没有模态对话框出现,我期望它.我正在使用流星.

这是我的代码

<div class="container">
    <h2>Example of creaTing Modals with Twitter Bootstrap</h2>
    <div class="modal hide fade in" id="example" style="display: none; ">
        <div class="modal-header">
            <a class="close" data-dismiss="modal">×</a>
            <h3>This is a Modal heading</h3>
        </div>
        <div class="modal-body">
            <h4>Text in a modal</h4>
            <p>You can add some text here.</p>
        </div>
        <div class="modal-footer">
            <a class="btn btn-success" href="#">Call to action</a>
            <a class="btn" data-dismiss="modal" href="#">Close</a>
        </div>
    </div>
    <p><a data-toggle="modal" href="#example" class="btn btn-priMary btn-large">Launch
        demo modal</a></p>
</div>

我基本上从http://www.w3resource.com/twitter-bootstrap/modals-tutorial.php获得了代码用于测试目的.

解决方法

我有一个类似的问题.问题是Meteor和Bootstrap如何工作的根本区别. Meteor假设可以随时重新加载标记.如果任何实时变量发生变化,Meteor只会重新加载模板.另一方面,Bootstrap假定模板只加载一次,并在运行时使用javascript进行修改.

发生了什么是流星正在加载我的模态模板.在某些时候我点击某些东西,这会导致该模态出现在javascript中.但是,一瞬间,实时变量会更改,导致模板再次加载.由于模板隐藏了模态,因此它会覆盖刚刚尝试显示模板的javascript.

我通过将模态的内部放在与外部不同的模板中来解决这个问题.外部模板不响应任何实时变量,因此希望永远不会重新加载.

之前:

<template name="modal">      
  <div class="modal hide fade in" id="setTings-modal" data-BACkdrop="false">
    <div class="modal-header">
    ...
</template>

后:

<template name="modal">      
  <div class="modal hide fade in" id="setTings-modal" data-BACkdrop="false">
    {{> modalInner}}
  </div>
</template>      

<template name="modalInner">
  <div class="modal-header">
    ...
</template>

大佬总结

以上是大佬教程为你收集整理的twitter-bootstrap – Bootstrap模式不会出现在Meteor中全部内容,希望文章能够帮你解决twitter-bootstrap – Bootstrap模式不会出现在Meteor中所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。