我们正在使用JCrop库裁剪个人资料照片。当用户更改其个人资料照片时,新照片仍然使用旧图像尺寸。这适用于Chrome,但在Firefox中不起作用。我使用destroy:
删除了上一个图像和JCropjcrop_api.destroy();
我还添加了这行代码,试图清除包含宽度和高度的样式。
$('#target').removeAttr('style');
答案 0 :(得分:0)
我也遇到了这个问题,我尝试了一切,最后发现了一个对我有用的解决方法:
如果再次使用Firefox和jcrop销毁和初始化,必须有alert()函数。
// Clear selector
if (jcropAPI) {
jcropAPI.destroy();
}
initCropper();
// If browser is Firefox, fix bug with stretching
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
// Do Firefox-related activities
alert('File successfully loaded'); // this alert is necessary
if (jcropAPI) {
jcropAPI.destroy();
}
initCropper();
}