Adjust width and height of iframe to fit with content in it

前端 未结 30 2744
旧时难觅i
旧时难觅i 2020-11-22 02:09

I need a solution for auto-adjusting the width and height of an iframe to barely fit its content. The point is that t

30条回答
  •  余生分开走
    2020-11-22 02:50

    I slightly modified Garnaph's great solution above. It seemed like his solution modified the iframe size based upon the size right before the event. For my situation (email submission via an iframe) I needed the iframe height to change right after submission. For example show validation errors or "thank you" message after submission.

    I just eliminated the nested click() function and put it into my iframe html:

    
    

    Worked for me, but not sure about cross browser functionality.

提交回复
热议问题