【问题标题】:jquery dialog not appearingjquery对话框没有出现
【发布时间】:2013-01-09 09:57:13
【问题描述】:

我的页面应该发布一个对话框,说明要使用的一组指南。一个 php 脚本识别哪个(s)并相应地创建 div(s)。

那我做一个简单的$(document).ready( function() { $("#guidelines").dialog();})

内部文本 (TEXT HERE) 显示为 html 半秒钟然后“消失”。

使用 Firefox 的 Inspect Element 3D View 我可以看到对话框在那里,它只是变得不可见(http://imgur.com/R5vx9 - 指南对话框位于红色框内)。

通过下面的代码,您可以看到“display:block”已设置,并且我已确保包含指向 css 的链接。

我检查了不同工作表是否存在任何冲突的 css 参数,但到目前为止还没有找到。

这里是html

<div aria-labelledby="ui-id-1" role="dialog" tabindex="-1" style="outline: 0px none; z-index: 1001; position: relative; height: auto; width: auto; top: 300px; left: 0px; display: block;" class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable">
    <div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
        <span class="ui-dialog-title" id="ui-id-1">Guidelines</span>
        <a role="button" class="ui-dialog-titlebar-close ui-corner-all" href="#">
            <span class="ui-icon ui-icon-closethick">close</span>
        </a>
    </div>
    <div scrollleft="0" scrolltop="0" style="width: auto; min-height: 20px; height: auto;" class="ui-dialog-content ui-widget-content" id="guidelines">
        TEXT HERE
    </div>
</div>

有什么帮助吗?

【问题讨论】:

  • 我猜可能是关于 z-index 属性。

标签: jquery html dialog


【解决方案1】:

试试下面:

$("#guidelines").dialog(
{
    autoOpen: true,
    show: "blind",
    hide: "explode",
    closeOnEscape: false,
    close : function()
    {
        $( this ).dialog( "close" );
    },
    buttons:
    {
        "YES": function()
        {
            ajax_call(href);
        },
        "NO": function()
        {
            $( this ).dialog( "close" ).dialog('destroy').remove();
            return false;
        }
    }
});

【讨论】:

  • 感谢这让它出现,我已经测试过了,看来我只需要:show: "blind"
  • 不能 +1 很抱歉,我没有足够的声誉,虽然接受了答案
【解决方案2】:

我知道 autoOpen 属性默认设置为“true”,但以下代码可能会对您有所帮助

$('#guidelines').dialog('open');

对话函数初始化后调用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-06
    • 1970-01-01
    相关资源
    最近更新 更多