2012-03-23 106 views

回答

-1

這應該這樣做。從孩子

beforeShow: function(){ 
    this.width = $('.fancybox-iframe').contents().find('html').width(); 
    this.height = $('.fancybox-iframe').contents().find('html').height(); 
} 

爲了得到這個從框架中運行,你需要火父$ fancybox.update():

$.fancybox({ 
    width:600, 
    height:300, 
    autoResize:false 
}); 
+0

您的解決方案對我無效 – 2012-11-21 05:29:47

0

我用前戲選項來調整它的大小。頁面,它應該調整它的大小。

0

您可以根據內容寬度和高度來調整iframe的寬度和高度,通過使用此選項autoSize爲true。 如果autoSize爲true,則將autoHeight和autoWidth都設置爲true。這意味着對於'內聯','ajax'和'html'類型的內容寬度和高度是自動確定的。

$.fancybox.open({ 
padding : 0, 
href:'http://www.gamespot.com', 
type: 'iframe', 
autoSize: true 
});