我正在使用fancybox版本2.1.5 我想要做的是在fancybox iframe中顯示大約寬度900和高度500的大圖像。當然,不適合那個iframe。 我很難捕捉正確的類或導航到圖像的方式來調整它的大小。我試着用beforeShow功能,做到這一點:fancybox - 在iframe中調整圖像的尺寸
$(".fancybox").fancybox({
type: 'iframe',
href: source,
title: title,
width: 900,
height: 500,
closeBtn: false,
nextSpeed: 0, //important
prevSpeed: 0, //important
beforeShow: function() {
alert('its working!');
$(".fancybox-iframe img").css("width","900px");
$(".fancybox-iframe img").css("height","auto");
$(".fancybox-iframe img").addClass("imageResize");
}
});
然而,無論是$(".fancybox-iframe img")
也不$(".fancybox-inner img")
是觸發IMG正確的方式。 如何使用beforeShow
函數在fancybox iframe中正確調整圖像大小。 謝謝!