简体   繁体   English

模态框未完全显示

[英]Modal box doesn't show completely

I'm using Bootstrap to layout my page and use modal boxes at some places. 我正在使用Bootstrap来布局我的页面并在某些地方使用模式框。 Now when I click on a link, it opens a confirmation modal box, at least it's suppose to. 现在,当我单击链接时,它至少会打开一个确认模式框。 However, if the window is too wide (~ >700px) it will only show part of the modal box: 但是,如果窗口太宽(〜> 700px),它将仅显示模式框的一部分:

在此处输入图片说明

If the window is small enough (maybe related to responsiveness) it will show the whole screen. 如果窗口足够小(可能与响应能力有关),它将显示整个屏幕。

Here is how I implemented the modal box. 这是我实现模式框的方式。

<a class="confirm-delete" data-id=someValue role="button"><i class="icon-trash"></i></a>

$('.confirm-delete').click(function(e) {                
    e.preventDefault();                                 
    var id = $(this).data('id');                        
    $('#deleteConfirmation').data('id', id).modal('show');                                                              
});

$('#deleteConfirmation').bind('show', function() {
    var id = $(this).data('id');                        
});

Here is part of the css and scripts I include: 这是我包括的CSS和脚本的一部分:

<link rel="stylesheet" href="${cherrypy.url('/asset/css/bootstrap.css')}" media="screen" />
<link rel="stylesheet" href="${cherrypy.url('/asset/css/glyphicons.css')}" media="screen" />
<link rel="stylesheet" href="${cherrypy.url('/asset/css/datepicker.css')}" media="screen" />
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link rel="stylesheet" href="${cherrypy.url('/asset/css/modified-bootstrap-responsive.min.css')}" media="screen" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" type="text/css" />

Any ideas what could be the reason for the not completely showing modal box? 任何想法可能是未完全显示模式框的原因吗? Sorry, I can't reproduce the problem in a fiddle nor provide a live site. 抱歉,我无法重提问题,也无法提供实时站点。

<script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script>                              
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js" type="text/javascript"></script>                        
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>                      
<script src="${cherrypy.url('/asset/js/bootstrap-datepicker.js')}"></script> 

EDIT: I don't have much content on the HTML page. 编辑:我在HTML页面上没有太多内容。 Just a button and the confirmation box. 只需一个按钮和确认框。

This is the structure of the page: 这是页面的结构:

<%! import cherrypy %>
<!DOCTYPE html>
<html>
<head>
    <%include file="header.mako"/>
</head>
    <!-- Piwik Tracking Code -->
<body>
<%include file="navigation.mako"/>
    <div class="container">
        <p>
            ${self.body()}
        </p>
    </div>
  </body>
</html>

header.mako consists of the style sheets I posted above and ${self.body()} is the confirmation dialog and JS (posted above): header.mako由我上面发布的样式表组成, ${self.body()}是确认对话框和JS(上面发布):

<div class="modal hide fade" id="deleteConfirmation" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button
        <h3>Confirmation</h3>
    </div>
    <div class="modal-body"><p class="error-text">Sure?</p>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button><a href="${cherrypy.url('email=')}" class="btn btn-danger">Delete</a>
    </div>
</div>

Looks like this line: 看起来像这行:

<link rel="stylesheet" href="${cherrypy.url('/asset/css/bootstrap.css')}" media="screen" />

is conflicting with the combined bootstrap file coming from the cdn: 与来自CDN的组合引导文件冲突:

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">

Just remove the bootstrap.css link coming from assets and you should be good. 只需删除来自资产的bootstrap.css链接,您就可以了。

Note: This was derived from the comments - just putting here in case this happens to anyone else 注意:这是从评论中得出的-只是放在此处以防其他任何人碰到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM