从元素中删除 jquery imgareaselect 插件
所以我使用这个简洁的jquery插件 http://odyniec.net/projects/imgareaselect/ 它工作正常,但我用 jquery ui 回调函数(对话框)触发它,并且我需要在对话框关闭后删除选择。
function initialize_selection() {
$('#image_area').imgAreaSelect({ x1: 10, y1: 10, x2: $('#image_area').width()-10, y2: $('#image_area').height()-10 , fadeSpeed: 400, handles: true});
}
$(function() {
$('#image_edit').click(function(){
$('#edit_image_dialog').load('actions.php?action=edit_temp_image', function(){
$('#edit_image_dialog').dialog({
modal: true,
resizable: false,
width: 480,
buttons: {
Ok: function() {
//foo_bar
},
Cancel: function() {
//foo_bar
}
},
beforeclose: function(){
//What should i put here ???
;}
});
initialize_selection();
});
});
});
我真的很感激一些提示,因为我是 jquery 的新手,我自己无法解决这个问题。
谢谢
So im using this neat jquery plugin http://odyniec.net/projects/imgareaselect/
It works fine, but i'm firing it with jquery ui callback function (dialog), and i need to remove the selection after dialog closes.
function initialize_selection() {
$('#image_area').imgAreaSelect({ x1: 10, y1: 10, x2: $('#image_area').width()-10, y2: $('#image_area').height()-10 , fadeSpeed: 400, handles: true});
}
$(function() {
$('#image_edit').click(function(){
$('#edit_image_dialog').load('actions.php?action=edit_temp_image', function(){
$('#edit_image_dialog').dialog({
modal: true,
resizable: false,
width: 480,
buttons: {
Ok: function() {
//foo_bar
},
Cancel: function() {
//foo_bar
}
},
beforeclose: function(){
//What should i put here ???
;}
});
initialize_selection();
});
});
});
I would really appreciate some tips, because i'm new to jquery and I can't work this out by myself.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
http://odyniec.net/projects/imgareaselect/usage.html
应该可以,但是没有把握
http://odyniec.net/projects/imgareaselect/usage.html
should work, but not sure
我发现删除选择处理区域的唯一方法如下:
以下内容对我不起作用(在 WordPress 3.0.5 中的 jquery 和 jqueryui 元素中)
The only way I've found to get the selection treatment areas removed was the following:
The following did not work for me (in the jquery and jqueryui elements in Wordpress 3.0.5)
这对我有用:
This worked for me:
根据 HomeimgAreaSelect Documentation 上的选项文档
即可解决问题
According to the documentation for the options at HomeimgAreaSelect Documentation
will do the trick
根据文档: http://odyniec.net/projects/imgareaselect/usage.html
{remove: true} 实际上会完全删除 imgAreaSelect-y-ness。如果您想要做的只是框和灰色区域(但允许用户稍后拖动新框),您需要 {hide: true}。
According to the documentation: http://odyniec.net/projects/imgareaselect/usage.html
{remove: true} will actually remove the imgAreaSelect-y-ness completely. If all you want to do is box and grayed out area, (but allow the user to drag a new box later) you want {hide: true}.
第一个语句隐藏 imgareaselect,第二个语句有助于在下次加载模式时重新加载裁剪功能。
我在从模式返回主窗口时使用了这两个语句,这样下次加载裁剪功能就不会出现问题。
First statement hides the imgareaselect and the second statement helps in reloading the crop functionality when the modal is loaded the next time.
I used both the statements while returning to the main window from the modal so that there is no issue loading the crop functionality next time.
是的,它确实有效,但是在 -->$('#image_area').imgAreaSelect({remove:true}); 之后
它无法用于标记其他照片
ya it really work but after -->$('#image_area').imgAreaSelect({remove:true});
It cannot work on tagging other photo