Auto Height iFrame Jquery Cross Domain Auto Adjust Resize Plugin

How to resizing an iframe based on content size with out scroll bars ?
Simple steps..just add the below line of  iframe resizing script code before the head tag of your webpage..this code working in all browsers (IE6 + , Safari, Google Chrome, Opera, Mozilla firefox)..

$(document).ready(function()
    {
        var resizing = document.getElementsByTagName('iframe');

        function iframeresizing()
        {
            for (var a = 0, b = resizing.length; a < b; a++)
            {
                resizing[a].style.height = resizing[a].contentWindow.document.body.offsetHeight + 'px';
            }
        }
        if ($.browser.safari || $.browser.opera)
        {
            $('iframe').load(function()
                {
                    setTimeout(iframeresizing, 0);
                }
            );
            for (var a = 0, b = resizing.length; a < b; a++)
            {
                var iSource = resizing[a].src;
                resizing[a].src = '';
                resizing[a].src = iSource;
            }
        }
        else
        {
            $('iframe').load(function()
                {
                    this.style.height = this.contentWindow.document.body.offsetHeight + 'px';
                }
            );
        }
    }
);

1 comments:

Post a Comment

How can we help? We’ll get back to you within 12 hours.
Feel free to ask,Your feedback is always appreciated...

Latest updates