davidjbradshaw / iframe-resizer

Keep iFrames sized to their content.
https://iframe-resizer.com
Other
6.65k stars 981 forks source link

Iframe Didn't work properly when added a class to hide some text. #1168

Closed masihurgmail closed 11 months ago

masihurgmail commented 1 year ago

Hi,

I am using resizer library on our site almost 5 year. Now I have added a new feature, like if the post content is large then set the max height of the post and show only 100 px of then in the post, also show "Read More" option to the user.

Now I am facing issue with this functionality, the iframe resizer didn't reduce the size of iframe when add a class to hide the post.

In this case there are a large white space shown in the bottom.

I tried to resolve the issue to call the function after add the class. But didn't fix the issue. Wile if added any content dynamically then the iframe height automatically increases.

Please have a look of the issue.

davidjbradshaw commented 11 months ago

If all else fails you can manual force a resize.

if ('parentIFrame' in window) {
  parentIFrame.size()
}