Bootstrap模态仅显示背景

Jam*_*mes 9 html javascript jquery twitter-bootstrap

编辑:我发现了这个问题.原来让这个页面错过了<div>他/她创建的模态的结束标记的人,所以我的模态的内容隐藏在原始内容中.

我的引导模式没有显示对话框,而只显示黑暗的背景.我在页面的页脚中设置了以下模式.

<div id="timePopup" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" style='border-radius:0px;width:430px;margin-left:-215px'>
    <div class="modal-body">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="position: absolute; top: 3px; right: 7px; z-index: 9999;">&times;</button>
        <div class="modal-body" style='border: black solid 2px;margin: 5px;'>
            <?php echo $popup_content; ?>
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

$popup_content只包含简单的字符串'Test test test test'.它由调用此函数的onclick属性触发<span>

function forcePopUp(){
    jQuery('#timePopup').modal('show');
}
Run Code Online (Sandbox Code Playgroud)

完全相同的代码在我们的开发服务器上运行,但是自从将它移动到测试服务器后,这已经开始发生,或者我认为没有发生.

从SO上的另一篇文章中我尝试从模态中删除.hide类,并确保此模态具有唯一ID.任何其他想法为什么会受到赞赏.

psc*_*eit 5

如果模态 html 渲染到页面的隐藏区域,它也不会显示


小智 2

尝试:

$(function(){
 $('.selector').click(function() {
   $('#timePopup').modal('show');
 });
});
Run Code Online (Sandbox Code Playgroud)

其中 .selector 指的是 span 元素中的类或 id。