当我从 Unsplash.com 插入新图像时,图像大小“full”会返回一个缩放图像,名称文件末尾带有“-scaled.jpg”,并且始终限制为 2560 像素。那么如何检索图像的真实“完整”尺寸呢?
我需要听 WooCommerce 的自定义事件,例如wc_fragment_refresched
或added_to_cart
。但是,当通过本机为这些事件创建侦听器时,addEventListener
什么也没有发生。但 jQuery.on()
工作得很好。
在职的:
jQuery(document.body).on('wc_fragments_refreshed', function() {
console.log("hehey!");
});
Run Code Online (Sandbox Code Playgroud)
不工作:
document.body.addEventListener('wc_fragments_refreshed', function() {
console.log("hoho!");
});
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么本地监听器不工作?