iframe-resizer icon indicating copy to clipboard operation
iframe-resizer copied to clipboard

height calculations differing for same content after dynamic change inside iframe

Open cam-jordan opened this issue 3 years ago • 2 comments

The resizer script seems to be working well, except my height calculations are not consistent when content is reduced. The content displayed inside our iframe is a simple directory search form that displays department results underneath using a javascript submitted form post. Depending on the search, this results list varies in height for each submission and needs to adjust accordingly. I can search for "Marketing" which gives me 20 results and the height calculation works (style="overflow: hidden; height: 4281px;"). I then search for "Technology" which has closer to 40 results and the height calculation properly increases (style="overflow: hidden; height: 7123px;"). If I then, however, search for "Marketing" again the height does not adjust back down to the original 4281px (style="overflow: hidden; height: 6938px;"), leaving a large white space under my iframe content.

I've checked for elements set to 100% height and am not seeing anything, and have tried various height calculation methods to no avail. Any insight for this?

Thanks

cam-jordan avatar Jul 22 '21 15:07 cam-jordan

Try different height calculation methods. lowestElement and taggedElement normally work the best

davidjbradshaw avatar Jul 22 '21 17:07 davidjbradshaw

I had this exact same issue with dynamic content and using taggedElement fixed it. However, I had to remove height: 100% from it, otherwise it wouldn't work.

None of the other options worked.

obedparla avatar Nov 29 '21 18:11 obedparla