I'm using jQuery Fancybox to display forms in a modal window. I'm using the following code:
$("a.iframe").fancybox({
'padding': 0,
'width': 650,
'showCloseButton': false,
'hideOnContentClick': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'onComplete': function () {
$('#fancybox-frame').load(function () {
$('#fancybox-content').height($(this).contents().find('body').height() + 20);
});
}
});
With the additional onComplete function, I'm able to adjust the height of the iframe accordingly to the height of the contents inside.
However, I've hidden a few elements with jQuery's .hide() inside the iframe. Whenever I want to .show() these elements, the iframe itself doesn't resize along with the extra height of the now visible elements.
How can I acplish this? Thanks!
I'm using jQuery Fancybox to display forms in a modal window. I'm using the following code:
$("a.iframe").fancybox({
'padding': 0,
'width': 650,
'showCloseButton': false,
'hideOnContentClick': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'onComplete': function () {
$('#fancybox-frame').load(function () {
$('#fancybox-content').height($(this).contents().find('body').height() + 20);
});
}
});
With the additional onComplete function, I'm able to adjust the height of the iframe accordingly to the height of the contents inside.
However, I've hidden a few elements with jQuery's .hide() inside the iframe. Whenever I want to .show() these elements, the iframe itself doesn't resize along with the extra height of the now visible elements.
How can I acplish this? Thanks!
Share Improve this question asked Sep 15, 2011 at 12:13 Martijn van TurnhoutMartijn van Turnhout 2711 gold badge6 silver badges20 bronze badges 1- 1 I think this trend has the answer to your request: Problem Adjusting Fancybox Iframe Overlay Width and Height – JAY Commented Dec 16, 2011 at 8:12
1 Answer
Reset to default 2Put the following function to the page
$.fn.ResizeFancy = function(){
$('#fancybox-content').height($('#fancybox-frame').contents().find('body').height() + 20);
};
After, trigger this function to your showHide function. For example;
function yourShowHideFn(){
//bla bla bla
$.fn.ResizeFancy();
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745462211a4628758.html
评论列表(0条)