Welcome to WebmasterWorld Guest from 18.205.176.85

Forum Moderators: phranque

Message Too Old, No Replies

Making a page fit the height of 3rd party iFrame

     
12:21 am on Jul 19, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

joined:Mar 15, 2013
posts: 1205
votes: 120


I'm working with an affiliate company that provides an iFrame that I embed to my page.

The problem is that the height of their iFrame changes dynamically, and it scrolls vertically separately from my page.

Can you guys suggest a way that I can modify my page to match the height of the iFrame? I can't change it on their end, all I can change is the container page on my end.

My options are Javascript, jQuery, CSS, or PHP if you can think of a way to do it server-side.
12:37 am on July 19, 2018 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 893


Put their iFrame in a <DIV> which you control size with CSS. Experiment what sizing units work best... em, percentages, etc.
1:32 am on July 19, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

joined:Mar 15, 2013
posts: 1205
votes: 120


Well, I think it's gonna have to be changed on their end... it looks like they have a predefined height of 775px, so no matter what I do it's going to scroll
1:57 am on July 19, 2018 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4563
votes: 364


If they've designed it to have a fixed height, you'll need to contain it where it can be shown at that height or tolerate the scrolling. Can it be located on its own page where that would be manageable?
2:34 am on July 19, 2018 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 893


it looks like they have a predefined height of 775px


I thought you said it changes dynamically
height of their iFrame changes dynamically
2:42 am on July 19, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

joined:Mar 15, 2013
posts: 1205
votes: 120


I did say that, but then I opened the iFrame outside of my page and saw that it was still 775px. So I was wrong in my original post.

I emailed them, and hopefully they can set a variable or something for me to change that so that it will be dynamic like I thought. If so, I'll post back and see if there's any way to make it look the way I want.