jQuery图像调整大小以适应模态的问题

Issue with jQuery images resizing to fit modal

本文关键字:模态 问题 图像 调整 jQuery      更新时间:2023-09-26

好吧,这个让我非常困惑(我花了几个小时试图弄清楚),所以我希望也许有一双新的眼睛能够比我更容易地发现罪魁祸首。

有问题的页面在这里:http://centerpointesigns.com/dev/portfolio/

转到桌面上的页面,打开GLA Building链接(带下划线)。

你会看到这个库(使用一个名为Envira gallery的WordPress插件)非常非常小,我知道这是因为它无法确定它所处的模式的大小(这是一个称为Easy modal的WordPress的插件)。

我在functions.js文件中添加了以下代码,假设它能修复它,但运气不好:

// Prevent resizing of Envira Galleries with Easy Modal plugin
$('.emodal').on('emodalBeforeOpen', function() {
$(window).triggerHandler("resize");
});

你觉得我在这里做错了什么吗?看起来应该很容易,我一定忽略了一些显而易见的东西。

functions.js第56行出现错误:"Uncaught TypeError:$不是函数"。

我用jQuery取代了$,你的图库现在看起来很棒:-)

jQuery('.emodal').on('emodalBeforeOpen', function() {  
  jQuery(window).triggerHandler("resize");
});