views:

83

answers:

1

Is it possible?

I have tried to move it, but iframe contents dissapear.

Tried to get contents of iframe and place them in the new place but all handlers ofc dissapear.

Tried to do the same, but with new jQuery 1.4.2 feature, that clones all events along with it.

But it doesn't work :)

So I have decided to ask here for help.

How to move the damn iframe to another place in the document without losing it's contents? ^_^

Thanks

Added:

txtad_iframe = ad_container.find('iframe');                 
its_contents = txtad_iframe.contents();
its_body = its_contents.find("div:first").clone(true).insertAfter(cthis.find('#photos'));

Here i'm trying to copy contents to new ad container. But it doesn't work. Context banner doesn't react on click event.

I have tried to move ad_container to container, but iframe body content dissapears.

A: 

I believe that items in an iframe aren't bound unless done so explicitly in that iframe. in other words, the iframe contents don't inherit the binding events from the parent window. you will have to bind first in the iframe and then move stuff around.

i think.

EDIT

I think you may want to do something like

its_body = its_contents.find("div:first").clone(true);
$(its_body).insertAfter(cthis.find('#photos'));
Jason
Clone(true) doesn't help. It seems it can't find any bound events to clone.And it seems it's impossible to move iframe without reloading it's contents.
Beck