How to change height of iframe based on dynamic conent within the iframe?

后端 未结 5 1141
攒了一身酷
攒了一身酷 2021-02-03 15:07

I have an iframe that has dynamic content. If the answers specific questions, additional information displays (hidden div becomes visible). I\'d like the height of the iframe

5条回答
  •  心在旅途
    2021-02-03 15:45

    Take a look at the jQuery postMessage plugin. It allows you to pass information from the child frame to the parent. You could change the code inside the child frame to post the content height to the parent on content change, which the parent could then use to resize the iframe accordingly.

    The two pages must be on the same domain to work.

    I hope this helps!

提交回复
热议问题