我正在构建一个弹出图像库,用户可以将图像从弹出 div 拖放到页面上的其他位置。
弹出画廊是一个覆盖 div(使用 css),因此没有 iframe 或类似的东西。
我已经使用 JQUERY UI 成功实现了拖放,但我想要的是 -
Whenever a user drags an image out of the gallery popup div, the popup div should hide/fadeout and the image can be dropped elsewhere. But the problem is, as soon as I hide the gallery popup div (originating container), my helper clone also disappears. (however the drop can still be made, but I lose the visual feedback)
我尝试将图库 div 的位置移动到 -999,-999(不隐藏它),但即使这样也会隐藏我的视觉反馈克隆(助手)
请有人帮我找到解决方案。
谢谢
最佳答案
您应该能够使用draggable 的appendTo 选项来完成此操作。默认情况下,助手会附加到与可拖动对象相同的容器中,这就是隐藏它时它会消失的原因。
也许这样的事情会起作用:
$( '.thumb' ).draggable( {
helper: 'clone',
appendTo: 'body',
start: function() {
$('#container').hide();
}
} );
希望有帮助。
关于jQuery UI 拖放 - 如何在拖动开始时隐藏原始容器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8388693/