1

I am creating content that will be loaded in an iframe by another site.

Certain links on the (iframed) page load content via Ajax and then show/hide it using the slideToggle (jQuery animation) function.

I found Resizing an iframe based on content great help in assigning the iFrame the correct height on page-load, but how can I increase the iFrame's height as the content changes dynamically (without reloading a page)?

Community
  • 1
  • 1
Richard Harris
  • 929
  • 3
  • 8
  • 14
  • are you using a plugin for iframe? for example colorbox plugin lets you size the iframe manual or automatically on the run – kommradHomer Apr 03 '12 at 10:57
  • I am not using any plugins, only jQuery, and the solution described in the page linked above. – Richard Harris Apr 03 '12 at 12:04
  • do you assign your iframe to an object ? you can change the style values of your iframe element by using the `parent.myIFrameObject` , sorry if its too simple and u've already tried – kommradHomer Apr 03 '12 at 12:09
  • I appreciate that you are trying to help but believe me, I have tried that and can not get it to work. :-/ – Richard Harris Apr 03 '12 at 12:37
  • well , i have one more last suggestion for you. even if you wont use [colorbox](http://www.jacklmoore.com/colorbox) , just go check the source code to see how it does that ? – kommradHomer Apr 03 '12 at 12:46

1 Answers1

0

You can't interact with a different domain's DOM in the means of JS from inside the iframe changing the properties of the iframe itself. Or otherwise, JS from the main document, inspecting/altering the DOM from inside.

You'd be better off loading the iframe's contents per AJAX as well.

keystorm
  • 342
  • 1
  • 10
  • Thanks for your answer but I think you misunderstand my question. If you read the page I included above, there is a way to size the iframe height based on my page's content. I just need to know how to do this WHILE an animation is running or after it is complete. Treat the question as though both pages are on the same domain. Forget exchanging the iframe with another method. That is not an option. – Richard Harris Apr 03 '12 at 12:02