2
我有一個網站,它有一個上傳圖像然後裁剪的選項。我已經使用jCrop庫。它在桌面瀏覽器上工作正常,但在移動設備上,選擇圖像後不會在彈出窗口上顯示圖像。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);
}
請從下面的截圖第一步和第二步(這是桌面screengrap)
第1步:
第2步:
但在移動第二步節目空圖像。爲什麼會發生這種情況,我需要做些什麼改變?
在移動設備上它被捕獲但不在裁剪窗口上顯示 – 2015-03-02 12:14:56
嘗試[DarkroomJS](http://mattketmo.github.io/darkroomjs/)查看更新的答案 – Saqueib 2015-03-02 12:26:04