【问题标题】:JCrop in Firefox attaches original image height/widthFirefox 中的 JCrop 附加原始图像高度/宽度
【发布时间】:2013-09-01 07:08:24
【问题描述】:

我们使用JCrop 库来裁剪个人资料图片。当用户更改他的个人资料图片时,新图片仍使用旧图像尺寸。这适用于 Chrome,但不适用于 Firefox。我使用销毁删除了以前的图像和 JCrop:

jcrop_api.destroy();

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

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

【问题讨论】:

  • 我遇到了同样的问题。你找到解决方案了吗?
  • 不,我们仍然收到此错误。
  • 嗨,保罗,我相信这个问题很相似,但不是重复的,因为我们了解如何删除 JCrop 对象。但是,在 Firefox 中,该功能不起作用。

标签: jquery css jcrop


【解决方案1】:

我也遇到了这个问题,我尝试了一切,终于找到了一个适合我的解决方法:

如果再次使用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();
}

【讨论】:

    猜你喜欢
    • 2017-07-12
    • 2012-07-15
    • 1970-01-01
    • 2012-03-27
    • 2014-04-26
    • 2011-04-09
    • 2014-05-28
    • 1970-01-01
    • 2019-02-12
    相关资源
    最近更新 更多