Option to set the frameHeight as a percentage of the viewport

10 views
Skip to first unread message

Kelvin Luck

unread,
Apr 6, 2009, 1:34:20 PM4/6/09
to fancybox
Hi,

First of all, great work on fancybox! I've just replaced another
lightbox script with it and it's much cleaner and nicer and more
flexible! Thanks for all the hard work.

I've got a feature request. I would like to be able to set the
frameHeight as a percentage of the available space on the viewport
(maybe with a maxHeight as well). I am showing an iframe and would
like to show as much of it as possible without scrolling (in the
iframe or in the host page).

I tried like this:


$(window).bind(
'resize',
function(e)
{

$('a.popup').fancybox(
{
'hideOnContentClick': false,
'frameWidth': 700,
'frameHeight': $(window).height() - 70,
'centerOnScroll': false
}
);
}
).trigger('resize');

Which kind of worked except that reinitialising the fancybox resulted
in it resizing through all sizes after it popped up.

Is there any way to change the frameHeight on an already initialised
fancybox? Or any other way to specify a dynamic frameHeight?

Thanks in advance,

Kelvin :)

Janis

unread,
Apr 7, 2009, 3:29:00 AM4/7/09
to fancybox
Sorry, it`s not currently possible to set w/h as percentage.

Janis

Kelvin Luck

unread,
Apr 10, 2009, 8:14:34 PM4/10/09
to fancybox
I know. That's why I made a feature request for it! ;)

The easier solution may be to allow reinitialising a fancybox which so
that my code given above would work as expected. Or to provide a
method that would "unfancybox" a given link (in which case I'd do this
and then re-initialise the fancybox on window resize).

Cheers,

Kelvin :)
Reply all
Reply to author
Forward
0 new messages