关闭对话框后,Div从原始位置消失 [英] Div disappears from original place after closing the dialog

查看:193
本文介绍了关闭对话框后,Div从原始位置消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jquery对话框.我的要求是从页面上已经存在的内容打开一个对话框.

I am trying to use jquery dialog. My requirement is to open a dialog box from a content which is already present on page.

但是当我关闭对话框时,该元素将从页面中消失.我希望它在关闭对话框后出现在同一位置.

But when I am closing an dialog box that element disappears from page. I want it to be present on the same place after closing the dialog.

有人可以指导我吗?

谢谢 Subhash

Thanks Subhash

推荐答案

当我们要求对话框时,jquery将该div附加到新的Dialog div,然后将该对话框div附加到主体,然后将其保留在该主体上.现在,每当调用对话框函数时,都会弹出相同的div.

When we call for dialog, jquery takes that div, appends it to new Dialog div, and this dialog div is appended to body and then it remains over there. Now whenever a dialog function is called same div is popped up.

所以我做的是,在对话框关闭时,销毁了对话框div,(它从主体中删除了对话框div).然后将我自己的div附加到以前的位置.

So what I did, on close of dialog , I destroyed dialog div, (It removed dialog div from body). Then appended my own div to previous position.


close : function(event, ui)
            {
                $("#myDiv").dialog("destroy");
                $(this).removeClass();
                $(this).removeAttr("style");
                $(this).appendTo($("#originalParentDiv"));
            }

这篇关于关闭对话框后,Div从原始位置消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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