Export to GitHub

nyromodal - issue #110

Iframe Resizing enhancement


Posted on Nov 6, 2008 by Happy Camel

Like with the youtube processHandler I've made an external file wich enables resizing for modals with an Iframe

nyroModal.iframe.js :

jQuery(function($){ $.fn.nyroModal.settings.endShowContent = function(elts, settings){ var iframe = elts.content.find('iframe'); if (iframe.length && iframe.attr('src').indexOf(window.location.hostname) !== -1) { var body= iframe.contents().find('body'); if (body.height() > 0) { $.nyroModalSettings({ height: body.height(), width: body.width() }); }

        iframe.bind('load', function(){
            var body= iframe.contents().find('body');
            if (body.length) {
                $.nyroModalSettings({
                    height: body.height(),
                    width: body.width()
                });
            }
        });
    }
};

});

Comment #1

Posted on Nov 6, 2008 by Swift Panda

Thanks for your code! Did you test it with IE and other browser (Safari, Opera)? with different domain in the iframe?

Comment #2

Posted on Nov 6, 2008 by Happy Camel

Yes, I've tried it with IE 6, 7 Safari, Opera and Firefox.

It only works for Iframes that link to the same domain. If someone knows a way to do it with external domains let me know, because as far as I know its considered cross site scripting.

Comment #3

Posted on Jan 27, 2009 by Swift Panda

anotherhero, your code will be included in the next release. If you have a blog or a website, I'll be glad to link it.

Comment #4

Posted on Feb 11, 2009 by Swift Panda

This code is now included in the release 1.4.0

Status: Fixed

Labels:
Type-Enhancement