拖动jQuery UI对话框框框移出iframe区域

3

我在iframe中打开了jquery可拖动对话框。它在iframe内部正常工作,但我无法将jquery对话框框拖到iframe外面。我想要在iframe外部拖动对话框。有人知道如何做到这一点吗?

以下是我在movable.php文件中使用的示例代码。

<html>
<head>
<link href="http://www.jquerydemo.dailyfreecode.com/Styles/Site.css" rel="stylesheet" type="text/css" />
<link href="http://www.jquerydemo.dailyfreecode.com/Styles/css/sunny/jquery-ui-1.8.22.custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="Javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" language="Javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<style>
.ui-dialog
{
position:relative !important;
top:0px !important;
}
</style>
</head>
<body>
<a id="hlOpenMe" href="#">Click Me to Open Dialog Box</a>
<div id="dialog" title="My Dialog Title">
<p>This is My Dialog box Description/Content</p>
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#dialog").dialog({ autoOpen: false });

$("#hlOpenMe").click(
function () {
$("#dialog").dialog('open');
return false;
}
);
});
</script>
</body>

now i have call iframe in demo.php page.

<iframe src="movable.php" id="name" name="test" width="50%" height="50%">
</iframe>

1
嘿,伙计,知道这个问题的答案。这对他很重要。 - Manish
谢谢 Manish,但我认为没有人能回答这个问题。这远远超出了他们的思维范围。 - Jimmy
1个回答

0

你不能这样做。对于你的脚本来说,浏览器窗口就是它所调用的 iFrame。jQuery并不知道iFrame外面还有什么。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接