jquery 从放置的 div 传递可拖动对象
我想在将可拖动对象放入可放置分区后更改其背景。我怎样才能传递当前被删除的对象?
假设有#drag div 和#drop div。将 #drag 移动到 #drop div 后。我想将#drag div 的颜色更改为黑色。
$("#drop").droppable({
drop: function(){
$(this).css('background','black');
},
});
我不知道如何将拖动的元素拖放到 #drop div 中后将其传递到可放置对象中。我以为“这个”会起作用。但它似乎指向#drop div
i want to change the background of the draggable object after being dropped in the droppable division. how can i pass the current object being dropped?
assume there is #drag div and #drop div. after moving #drag into #drop div. I want to change the color of #drag div to black.
$("#drop").droppable({
drop: function(){
$(this).css('background','black');
},
});
i have no idea how to pass the dragged element into the droppable object after dragging and dropping it into the #drop div. I assumed 'this' would work. but it seems that it points to the #drop div
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: