Jquery-tools 可滚动与 Jquery UI 可排序相结合

发布于 01-06 06:28 字数 447 浏览 3 评论 0原文

我有一个菜单系统,可以将菜单项从类别拖放到另一个容器中。我正在使用可滚动的 Jquery 工具一次显示一个类别,从而允许我对类别进行分页。 Jquery-scrollable 的工作原理是基于溢出,因此超出范围的任何内容都会被隐藏。效果很好。我的问题是,当从可滚动 div 拖动时,菜单项保持隐藏状态。我在网上搜索过并推荐了以下内容,但它不起作用。

$(".menu_item").mousedown(function(){$('#menu_item_1').appendTo('body')});

这样做的问题是,一旦我拖动 menu_item,它就会缩小到正文的底部,使得拖动有点困难。一旦我成功地将项目拖到容器中,那就没问题了......除非我想将它拖回我开始的地方。一旦我点击它就会消失,因为它现在被认为是身体的一部分。我还尝试更改该项目的 z-index 但无济于事。关于如何解决这个问题有什么建议吗?

I have a menu system where I drag and drop menu items from a category into another container. I am using Jquery tools scrollable to display one category at a time, allowing me to page through the categories. Jquery-scrollable works based off of an overflow so anything outside the bounds of the is hidden. Works great. My issue is when dragging from the scrollable div, the menu item stays hidden. I've searched the web and was recommended the following but it didn't work.

$(".menu_item").mousedown(function(){$('#menu_item_1').appendTo('body')});

The problem with this is that as soon as I drag the menu_item, It zooms down to the bottom of the body making dragging a bit difficult. Once I successfully drag the item to the container it's fine.....unless I want to drag it back to where I started. Once I click on it disappears because it is now considered part of the body. I've also tried to alter the z-index of the item to no avail. Any recommendations on how to solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

极致的悲2025-01-13 06:28:34

想通了。 Jquery UI sortable 具有以下功能。只需将其添加到可排序的 init 语句中即可。 appendTo 和 helper 允许此功能。杰出的

$('.available_items').sortable
  connectWith: '.menu_menu_items'
  appendTo: 'body'
  helper: 'clone'

Figured it out. Jquery UI sortable has the following function. Just add it to your sortable init statement. The appendTo and helper allow this functionality. Outstanding

$('.available_items').sortable
  connectWith: '.menu_menu_items'
  appendTo: 'body'
  helper: 'clone'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文