jQuery UI 对话框样式 - 溢出?

发布于 2024-10-01 02:27:30 字数 3890 浏览 1 评论 0原文

嘿 Stack,需要一些 jQuery UI 对话框样式方面的帮助。您可以在这里看到发生了什么:http://img714.imageshack.us/i/jquerydialogstylingissu。 png/.

验证消息和左上角的图标都被切断。我认为这是因为 .ui-dialog 有“溢出:隐藏”,但删除它没有效果(我可以看到)。任何人都可以提供任何建议以使这些正确显示吗?

附加左上角图标后标题栏的 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
    ];
}

Hey Stack, need some assistance with the styling of jQuery UI Dialogs. You can see what is happening here: http://img714.imageshack.us/i/jquerydialogstylingissu.png/.

The Validation Message and the Icon in the top left are both being cut off. I thought it was because .ui-dialog has "overflow: hidden", but removing that has no effect (that I could see). Can anyone offer any suggestions to get these displaying correctly?

The HTML for the title bar after attaching the top left icon is:

<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>

Edit (Thanks to Cubed Eye Studios):

Changing .ui-dialog and .ui-dialog-content to "overflow: visible" fixes this, however you will lose the auto-scroll on the content area and may get unexpected results for the title bar (Assuming there was a reason for overflow to be hidden on titles in the first place. I have not noticed anything different.). Losing the auto scroll is a big deal. Any suggestions to work around that would be greatly appreciated. Thanks.

Additional Code:

<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>

Tooltip Solution (only for this particular tooltip plugin)

Change the getCropping() function in the dynamic plugin for the tooltip, so that it works on the content container rather than the window.

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
    ];
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

锦欢 2024-10-08 02:27:30

对于图标,只需使对话框上的溢出可见即可。

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

验证消息看起来像 z-index 的东西,你可以发布更多代码吗?

For the icon, just make the overflow on the dialog visible.

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

The Validation message looks like a z-index thing, can you post some more code?

我一直都在从未离去 2024-10-08 02:27:30

我对那个工具提示插件不太熟悉,但我想工具提示是绝对放置的。我制作的这个演示似乎可以正常工作,也许你可以将其翻译为插件。

<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 大于标题部分。不确定这是否有任何帮助,但尝试一下。还要使它们都是相对的,而不是绝对的。

I'm not overly familiar with that tooltip plugin, but I imagine that the tooltips are placed absolutely. I made this demo that seemed to work correctly, maybe you can translate it to the plugin.

<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>

I just made sure that the z-index of the content part is bigger that the title part. Not sure if this is any help but give it a try. Also make them both relative, instead of absolute.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文