如何删除 jcrop?
如何取消 jcrop 图像?
我正在添加 jcrop ;
$('#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< /a>
不确定如何修复它。
how do i un-jcrop an image?
I'm adding jcrop with a;
$('#imgThumbnailer').Jcrop({
onChange: statusCrop,
onSelect: statusCrop,
bgColor: 'black',
bgOpacity: .3
});
How do I go about undoing it?
Edit:
$('#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'));
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想知道同样的事情,在阅读源代码后发现了一个在 v0.9.8 中工作的简单解决方案(其他发布的答案目前仅适用于开发版本)。如果您像这样启动 Jcrop:
那么您可以通过以下方式访问 api 并销毁 Jcrop:
对于提问者来说可能为时已晚,但希望这对从 google 偶然发现此页面的人有帮助!
I was wondering the same thing and after reading the source have found a simple solution that works in v0.9.8 (the other posted answers only work with the dev version currently). If you initiate Jcrop like this:
then you can get access to the api and destroy Jcrop via:
It's probably too late for the asker but hopefully this is helpful to someone who stumbles upon this page from google!
编辑:当您将 jcrop 添加到图像时,看起来您需要维护对 api 的引用。
Edit: Looks like you need to maintain a reference to the api when you add jcrop to an image.
从 Jcrop v0.9.9 版本开始,您需要按照以下方式执行此操作:
由创建者提供:http: //deepliquid.com/content/Jcrop_API.html
As of version v0.9.9 of Jcrop, you need to do it the following way:
Courtesy of the creator: http://deepliquid.com/content/Jcrop_API.html