Fancybox auto iframe resize. Plz help me!

1,008 views
Skip to first unread message

manojfelis

unread,
Oct 5, 2011, 2:42:47 PM10/5/11
to fancybox
I integrated fancybox in my website and everything is working fine.

but in iframe it shows fixed iframe window size. autoresize funtion is
not working.

can anyone help me how to fix this. i want auto resizing iframe. first
it gets username and password (small page size only) and after
validation it goes to another webpage and the iframe must fit to the
size of the webpage.

currently my fancybox is doing all the above things in fixed iframe
window size:-(

please anyone help me. if need to chage code tell me where in js or
css????

thank you.

RavanH

unread,
Oct 6, 2011, 2:34:20 AM10/6/11
to fancybox
There is no auto-resizing for iframes in FancyBox. Only for images.
And maybe inline content but I have not tested that...

Charlau

unread,
Oct 14, 2011, 9:19:09 PM10/14/11
to fanc...@googlegroups.com
I'm doing it this way in a current project. Works pretty well :

(from within the container page)

            // Resizing to max its content height, but never more than the viewport. Needed for my project, but optional
            var max_h = $("#fancybox-frame").contents().height();
            var viewport_h = document.documentElement.clientHeight - 30;
            var new_h = ((max_h < viewport_h) ? max_h : viewport_h);
            $('#fancybox-content').css('height', function() { return parseInt(new_h) });
            $.fancybox.center();


(if called from the iframed page itself)

        var max_h = parent.$("#fancybox-frame").contents().height();
        var viewport_h = parent.document.documentElement.clientHeight - 30;
        var new_h = ((max_h < viewport_h) ? max_h : viewport_h);
        parent.$('#fancybox-content').css('height', function() { return parseInt(new_h) });
        parent.$.fancybox.center();

Gabriel McKenna

unread,
Mar 27, 2013, 5:47:34 PM3/27/13
to fanc...@googlegroups.com
So where would I place this code to make it work?
Reply all
Reply to author
Forward
0 new messages