jQuery UI droppables - 更改丢弃的图像 [英] jQuery UI droppables - changing the image that's dropped

查看:146
本文介绍了jQuery UI droppables - 更改丢弃的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jQuery UI的droppables ,并且想知道删除的克隆使用与被删除的项目不同的 IMG SRC 的最佳方法。

I'm working with jQuery UI's droppables and am wondering what the best way to make the dropped clone use a different IMG SRC than the item being dropped.

在照片管理器演示中,缩略图被放入与大小相同的插槽。我想把一个大的图像放入一个小插槽,因此我需要它的克隆使用我的缩略图,而不是完整的图像。

In the photo manager demo there, the thumbnail gets dropped into a slot that's the same size. I'd like to drop a large image into a small slot, and as such I need its clone to use my thumbnail instead of the full image.

推荐答案

droppable API在其选项中接受drop回调。使用它来更改图像的src,例如:

The droppable API accepts a 'drop' callback in its options. Use it to change the src of the image, something like:

  $('#dropContainer').droppable({
       drop: function(e,ui) {
            $(ui.draggable).attr('src','/path/to/different/image');
       }
  });

这篇关于jQuery UI droppables - 更改丢弃的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆