如何删除jcrop? [英] How do I remove jcrop?
本文介绍了如何删除jcrop?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何取消裁剪图像?
我要在jcrop中添加一个;
I'm adding jcrop with a;
$('#imgThumbnailer').Jcrop({
onChange: statusCrop,
onSelect: statusCrop,
bgColor: 'black',
bgOpacity: .3
});
我该如何撤消它?
$('#imgThumbnailer').attr("src", $obj.attr('thumbnailer_link'));
var dlg = $("#ThumbnailDialog").dialog({
modal: false,
draggable: false,
position: 'center',
zIndex: 99999, // Above the overlay
closeText: '',
width: 510,
height: 500,
open: function () {
$('body').css("overflow", "hidden");
if ($.browser.msie) {
$('html').css("overflow", "hidden");
}
$("#loader").show();
var ratio = parseFloat($obj.attr('thumbnailer_ratio'));
jcrop_api = $.Jcrop('#imgThumbnailer', {
onChange: statusCrop,
onSelect: statusCrop,
bgColor: 'black',
bgOpacity: .3,
aspectRatio: ratio
});
},
close: function () { $('body').css("overflow", "auto"); if ($.browser.msie) { $('html').css("overflow", "auto"); } $("#loader").hide(); },
buttons: {
'Set Thumbnail': function () {
$(this).dialog('close');
},
Cancel: function () {
jcrop_api.destroy();
jcrop_api = null;
$(this).dialog('close');
}
}
}).parent();
dlg.appendTo(jQuery('form:first'));
以上代码对我不起作用.我认为这与我在jquery对话框中使用它的事实有关. http://code.google.com/p/jcrop/issues/detail?id=21
The above code will not work for me. I think this has to do wth the fact that Im using this within a jquery dialog. http://code.google.com/p/jcrop/issues/detail?id=21
不确定确切的解决方法.
Not sure exactly how to go about fixing it.
推荐答案
将jcrop添加到图像时,您似乎需要维护对api的引用.
Looks like you need to maintain a reference to the api when you add jcrop to an image.
// assign jcrop to jcrop_api
var jcrop_api = $.Jcrop('#imgThumbnailer', {
onChange: statusCrop,
onSelect: statusCrop,
bgColor: 'black',
bgOpacity: .3
});
// when you want to remove it
jcrop_api.destroy();
这篇关于如何删除jcrop?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文