jQuery – iframe height auto adjust

I used a solution for auto adjust height of iframe to fit with content in it. This is a good solution to solve the problem completely and it’s simple.

$(function () {

            $('#myIframe').load(function () {
                this.style.height =
                 this.contentWindow.document.body.offsetHeight + 'px';
            });
});
Share this nice post:

One thought on “jQuery – iframe height auto adjust

Leave a Reply

Your email address will not be published. Required fields are marked *