当使用jquery创建一个对话框时,如何隐藏对话框div? [英] When creating a dialog with jquery, how do I hide the dialog div?

查看:97
本文介绍了当使用jquery创建一个对话框时,如何隐藏对话框div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此页面中创建一个对话框:

I am creating a dialog like in this page:

http://jqueryui.com/demos/dialog/#modal-confirmation

(点击查看源代码)

底部是放置在对话框中的div。对话框工作完美的时候被javascript调用,但对话框显示在页面的底部,当它加载。 (减去javascript函数调用时所应用的所有样式)

on the bottom is the div that gets placed in the dialog. The dialog works perfect when called by the javascript but the dialog is apparent at the bottom of the page when it loads. (minus all the styling that gets applied when it is called by the javascript function)

如何隐藏div并仍允许对话框使用它?我尝试设置style =visibility:hidden
,但阻止它被javascript调用时显示。

How can I hide the div and still allow the dialog to use it? I have tried setting style="visibility:hidden" but that prevents it from being shown when called by the javascript.

推荐答案

这可能是一个愚蠢的问题,而不是visibility:hidden您尝试过display:none;?我必须解决同样的问题,我正在努力的项目,我相当肯定显示:无工作。

This may be a stupid question, but instead of "visibility:hidden" have you tried "display:none;"? I had to solve the same problem for a project I'm working on and I'm reasonably sure display:none worked.

您也可以使用

$(foo).dialog({ autoOpen: false });

选项初始化对话框(从而隐藏它和所有的好东西)。唯一的捕获是,你可能会看到对话框闪烁作为页面加载,但之前jQuery有机会隐藏它。

option to "initialize" the dialog (thus hiding it and all that good stuff). The only catch is, you'll probably see the dialog "flicker" as the page loads but before jQuery has a chance to hide it.

这篇关于当使用jquery创建一个对话框时,如何隐藏对话框div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆