User Tools

Site Tools


Sidebar

Index

jquery:resize-iframe-to-its-content

Resize an iframe to its contents

You have an iFrame and you want its height to automatically adapts to the size of the page in src.

$("#myframe").load(function() {
	$(this).height($(this).contents().find("body").height() + 30 );
});

NB: the number 30 is an arbitrary number to add extra space

jquery/resize-iframe-to-its-content.txt · Last modified: 2014/09/03 17:42 by rik