[英]How to trigger drag() without dragging
I am using jQuery UI or more specific the draggable feature. 我正在使用jQuery UI或更具体的可拖动功能。 Is it possible to trigger drag() and tell the element to move/drag somewhere without doing it yourself? 是否可以触发drag()并告诉元素将其移动/拖动到某个位置而无需自己进行操作? Something like el.dragTo(position). 类似于el.dragTo(position)。
Thanks in advance! 提前致谢!
EDIT: I am kinda using the draggable function as a resizer. 编辑:我有点使用可拖动功能作为调整大小。 I have a 1px thin div between two other divs. 我在其他两个div之间有一个1px的div。 When i drag the div in either direction i resize the other two divs depending on the amount i dragged the drag-div. 当我向任一方向拖动div时,我会根据拖动拖动div的数量来调整其他两个div的大小。
Use jQuery animate()
使用jQuery animate()
$(element).animate({
top: '10px',
left: '30px'
});
Demo: http://jsfiddle.net/maniator/BXVx2/ 演示: http : //jsfiddle.net/maniator/BXVx2/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.