我们的问题:我在 iframe 外面有一个可拖动的东西,里面有一个可放置的目标。在这里,我将 iframe 显示为包含由其 src 属性加载的 HTML 片段。
所以见代码:
内部 iframe 页面 (inner_iframe.html):
<body style="cursor: auto;">
<div id="container">
</div>
</body>
主页 :
<div id="main">
<iframe id="containeriframe" src="inner_iframe.html"></iframe>
</div>
<div id="container1">
<div class="drag" style="left: 20px;" id="lable"></div>
</div>
JavaScript 代码:
$("#containeriframe").load(function () {
var $this = $(this);
var contents = $this.contents();
// here, catch the droppable div and create a droppable widget
contents.find('#container').droppable({
iframeFix: true,
drop: function (event, ui) { alert('dropped'); }
});
});
$( "#lable" ).draggable({
revert: "invalid",
helper: "clone",
cursor: "move",
iframeFix: true
});
现在我使用 Jquery 1.8 和 Jquery UI。
所以我加载页面并尝试放入 iframe div 但没有响应,那么如何管理它。
请帮我 ....
谢谢