将图像拖放到在文本/内部元素之间移动的可内容编辑元素中?
所以我有一个 contenteditable=true div,其中有图像和文本。我想拖动此 div 中的图像来移动图像,同时拖曳和推开文本。我该怎么做?
谢谢!
PS:我尝试了 jquery-ui 可拖动/可放置,但我不希望它作为浮动 div。谢谢。
So I have a contenteditable=true div, of which there are images and text within this div. I would like to drag the images within this div to move the image around while shuffling and pushing the text away. How can I do this?
Thanks!
PS: I tried jquery-ui draggable/droppable, but I do not want it as a floating div. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试对您想要移动的所有项目使用 jquery .sortable 函数
$("img") .sortable();
并且让图像具有显示样式:内联(否则所有内容都会换行),但为了使文本环绕图像而不是在侧面或换行,它们需要浮动样式。
Try using the jquery .sortable function on all the items you want to be moveable
$("img").sortable();
And having the images have a style of display:inline (otherwise everything would break to a new line), but for the text to wrap around the images instead of being on the side or to break to another line they would need the float style.