gwegaweg
gwegaweg

Reputation: 33

How to automatically resize an iframe based on browser window width and document length?

I need to create a frameborder=0 iframe with no scroll bars.

It needs to automatically resize its width based on the browser window's current width.

Its height needs to be based on the document.length. So if it's a long page, the iframe needs to stretch way down.

This way, there is no scrollbar created in the iframe.

Upvotes: 1

Views: 4523

Answers (2)

ekhaled
ekhaled

Reputation: 2930

This question here may have the answer you are looking for...

Upvotes: 0

andres descalzo
andres descalzo

Reputation: 14967

var myIframe = $(document.frames['idIframe']);

$(document).bind('resize', function() {

   myIframe.attr("width", $(this).width());
   myIframe.attr("height", $(this).height());

});

Upvotes: 1

Related Questions