Pin*_*kie 11 iframe jquery append
我有
elm.appendTo('#wrap');
elmiframe中单击图像的jquery对象在哪里.我想这种形象附加到一个<div id="wrap">地方#wrap是在页面之外iframe的身体一个div.所以基本上当我双击iframe中的图像时,我希望该图像附加到<body>外部iframe.body和iframe链接都在同一个域中.
Rob*_*b W 13
parent可以被替换top,如果父文档是在顶部窗口):
//If the parent document doesn't have JQuery:
elm.appendTo(parent.document.getElementById("wrap"));
//Only if JQuery is included at the parent
elm.appendTo(parent.$("#wrap"));
parent.$("#wrap").append(elm);
Run Code Online (Sandbox Code Playgroud)
假设#elm是您的图像的ID.
// If JQuery is defined at the frame AND the parent (current document)
$("#wrap").append(frames[0].$("#elm"));
frames[0].$("#elm").appendTo($("#wrap"));
Run Code Online (Sandbox Code Playgroud)
frames[0]指当前文档中的第一帧.如果您name在框架上设置了属性,也可以使用frames.frame_name,或frames["frame_name"].
click事件侦听器elm:
elm.click(function(){
parent.$("#wrap").append(this);
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18994 次 |
| 最近记录: |