Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Jquery UI获取正在调整大小的图像的ID_Jquery_Resizable_Jquery Ui Resizable - Fatal编程技术网

使用Jquery UI获取正在调整大小的图像的ID

使用Jquery UI获取正在调整大小的图像的ID,jquery,resizable,jquery-ui-resizable,Jquery,Resizable,Jquery Ui Resizable,我正在使用jqueryui拖放和调整图像大小。我正在调整div中的图像大小,并拖动div以解决jqueryui中的错误(如果拖动并调整div的大小) 如何找到正在调整大小的图像的div ID 我的代码如下: $("img").resizable({ handles:'n,e,s,w,ne,se,nw,sw' , maxHeight: 300, aspectRatio: true, stop: function(event, ui) { alert( // want to send div

我正在使用jqueryui拖放和调整图像大小。我正在调整div中的图像大小,并拖动div以解决jqueryui中的错误(如果拖动并调整div的大小)

如何找到正在调整大小的图像的div ID

我的代码如下:

$("img").resizable({ handles:'n,e,s,w,ne,se,nw,sw' , maxHeight: 300, aspectRatio: true, 
stop:   function(event, ui) { alert( // want to send div ID of the image);} });
HTML代码

  <div id="pic1" style="float:left"> <img src="image source" height="150"></div>

我已尝试获取图像的div ID,但未成功
1.正在使用ui.originalElement[0].attr('id')、ui.originalElement.attr('id'))
2.使用event.trigger.id

这将为您提供所需的信息

$(this).parent().attr('id')

$(this.attr('id')
?“图像的divid”没有多大意义。你在问什么?图像包含在一个div中。我想获取div的ID。由于Jquery UI中的错误,我无法调整div的大小,但必须调整图像的大小。我想为正在调整大小的图像查找div的ID。例如,在本例中,我希望返回“pic1”$(此).attr('id')不起作用