Firefox中的JCrop附加原始图像高度/宽度

时间:2013-08-29 01:36:33

标签: jquery css jcrop

我们正在使用JCrop库裁剪个人资料照片。当用户更改其个人资料照片时,新照片仍然使用旧图像尺寸。这适用于Chrome,但在Firefox中不起作用。我使用destroy:

删除了上一个图像和JCrop
jcrop_api.destroy();

我还添加了这行代码,试图清除包含宽度和高度的样式。

$('#target').removeAttr('style');

1 个答案:

答案 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();
}
相关问题