【发布时间】:2015-03-02 11:46:07
【问题描述】:
我有一个网站,可以选择上传图片然后进行裁剪。我使用过 jCrop 库。它在桌面浏览器上运行良好,但在移动设备上它没有在弹出窗口中显示图像以在选择图像后进行裁剪。
// show_popup_crop : show the crop popup
function show_popup_crop(url) {
// change the photo source
$('#cropbox').attr('src', url);
// destroy the Jcrop object to create a new one
try {
jcrop_api.destroy();
} catch (e) {
// object not defined
}
// Initialize the Jcrop using the TARGET_W and TARGET_H that initialized before
$('#cropbox').Jcrop({
aspectRatio: TARGET_W / TARGET_H,
setSelect: [ 100, 100, TARGET_W, TARGET_H ],
allowResize: false,
trueSize: [200,300],
onSelect: updateCoords
},function(){
jcrop_api = this;
});
// store the current uploaded photo url in a hidden input to use it later
$('#photo_url').val(url);
// hide and reset the upload popup
$('#popup_upload').hide();
$('#loading_progress').html('');
$('#photo').val('');
// show the crop popup
$('#popup_crop').show();
}
function updateCoords(c) {
$('#x').val(c.x);
$('#y').val(c.y);
$('#w').val(c.w);
$('#h').val(c.h);
}
请在下面找到屏幕截图Step1和step2(这是桌面的屏幕截图)
第 1 步:
第 2 步:
但在移动 step2 上显示空白图像。为什么会发生这种情况,我需要做出哪些改变?
【问题讨论】: