jQuery UI对话框样式 - 溢出?

时间:2010-11-05 02:13:12

标签: jquery-ui coding-style dialog styling

Hey Stack,需要一些jQuery UI Dialog样式的帮助。你可以看到这里发生了什么:http://img714.imageshack.us/i/jquerydialogstylingissu.png/

验证消息和左上角的图标都被切断了。我认为这是因为.ui-dialog有“overflow:hidden”,但删除它没有任何影响(我可以看到)。任何人都可以提供任何建议来正确显示这些内容吗?

附上左上角图标后标题栏的HTML为:

<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
<img style="position: absolute; left: -28px; top: -25px; z-index: 2147483647;" src="/img/browser.png">
<span class="ui-dialog-title" id="ui-dialog-title-TaskEditWindow">Task Details</span>
<a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button">
<span class="ui-icon ui-icon-closethick">close</span></a>
</div>

编辑(感谢Cubed Eye Studios):

将.ui-dialog和.ui-dialog-content更改为“overflow:visible”修复此问题,但是您将失去内容区域的自动滚动功能,并且标题栏可能会出现意外结果(假设有一个溢出的原因首先隐藏在标题上。我没有发现任何不同的东西。)丢失自动滚动是一个大问题。任何解决这个问题的建议都将不胜感激。感谢。

附加代码:

<div style="display: block; z-index: 1004; outline: 0px none; height: auto; width: auto; top: 157px; left: 756px;" class="ui-dialog ui-widget ui-widget-content ui-corner-all  ui-draggable" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-StageEditWindow">
    <div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
        <img style="position: absolute; left: -23px; top: -20px;" src="/img/browser.png">
        <span class="ui-dialog-title" id="ui-dialog-title-StageEditWindow">Stage Details</span>
        <a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button"><span class="ui-icon ui-icon-closethick">close</span></a>
    </div>
    <div style="width: auto; min-height: 50.8px; height: auto;" id="StageEditWindow" class="ui-dialog-content ui-widget-content">
        <div class="screens-container">
            <div id="DetailsScreen">
                <form id="StageEditForm" action="#" onsubmit="return false;">
                    <fieldset id="DetailsFieldSet">
                        <div>
                            <label class="label" for="StageName">Name:</label>
                            <input type="text" class="input required validation-failed" name="Name" id="StageName">
                            <label for="StageName" generated="true" class="validation-failed" style="position: absolute; top: -121.95px; left: 107.1px; opacity: 0; display: none;">This field is required.</label>
                        </div>
                    </fieldset>
                </form>
            </div>
        </div>
    </div>
    <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
        <div class="ui-dialog-buttonset">
            <button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Save</span></button>
        </div>
    </div>
</div>

工具提示解决方案(仅适用于此特定工具提示插件)

更改工具提示的动态插件中的getCropping()函数,以便它可以在内容容器而不是窗口上工作。

function getCropping(el) {
    var w = $(el).closest('.ui-dialog-content');
    var right = w.offset().left + w.width();
    var bottom = w.offset().top + w.height();
    var toolTipRight = el.offset().left + el.width();
    var toolTipBottom = el.offset().top + el.height();

    return [
        el.offset().top <= w.offset().top,                      // top
        right <= toolTipRight,          // right
        bottom <= toolTipBottom,        // bottom
        w.offset().left >= el.offset().left                     // left
    ];
}

2 个答案:

答案 0 :(得分:2)

对于图标,只需在对话框上显示溢出即可。

<div class="ui-dialog" style="overflow:visible">

Validation消息看起来像z-index,你能发布更多代码吗?

答案 1 :(得分:1)

我对这个工具提示插件并不过分熟悉,但我想工具提示是绝对放置的。我做了这个似乎正常工作的演示,也许你可以把它翻译成插件。

<div class="ui-dialog" style="overflow:visible;">
   <div class="ui-dialog-title" style="position:relative; z-index:5">Title Bar</div>
   <div class="ui-dialog-content" style="position:relative; z-index:10">
      Content Here
      <div class="tooltip" style="position:absolute; top:-4px;">
           Tooltip Content
      </div>
   </div>
</div>

我确保内容部分的z-index比标题部分大。不确定这是否有任何帮助,但试一试。同时使它们都是相对的,而不是绝对的。