简体   繁体   English

拖放菜单项

[英]Drag and drop menuitems

I want to rearrange menuitems by drag and drop in my firefox addon like the bookmarks in the Bookmarks menu. 我想像在“书签”菜单中的书签一样通过拖放在firefox插件中来重新排列菜单项。 Specifically, I want the blue insertion marker to appear while dragging a menuitem over valid places. 具体来说,我希望在将菜单项拖动到有效位置上时显示蓝色插入标记。 Can someone show me how to do this or tell me where the relevant code for bookmarks is located? 有人可以告诉我如何执行此操作,或者告诉我书签的相关代码位于何处吗?

jQuery UI draggable and droppable are the two plugins I would use to achieve this effect. jQuery UI draggabledroppable是我用来实现此效果的两个插件。 As for the insertion marker, I would investigate modifying the div (or container) element that was about to have content dropped into it. 至于插入标记,我将研究修改即将要放入内容的div (或容器)元素。 It should be possible to modify the border in some way or add a JavaScript/jQuery listener that listens for the hover (element about to be dropped) event and modifies the border or adds an image of the insertion marker in the right place. 应该可以以某种方式修改边框或添加一个JavaScript / jQuery侦听器,以侦听悬停(即将被放置的元素)事件并修改边框或在正确的位置添加插入标记的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM