我正在使用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中正确调整图像大小。 谢谢!