gpt4 book ai didi

jquery - 使用 jQuery 和 jdMenu 插件创建多级可滚动菜单

转载 作者:行者123 更新时间:2023-12-01 04:32:08 25 4
gpt4 key购买 nike

在我们的应用程序中,我们使用 jdMenu plugin从嵌套的无序列表创建分层菜单。

example

这种方法效果很好,直到菜单中的项目过多而被迫从屏幕上消失为止。

it's too big!

为了解决这个问题,我更新了插件(实际上是 jdMenu 的要求的positionBy插件),以便当发现长菜单时,插件会降低菜单的高度(ul),应用溢出:隐藏并尝试再次放置它。然后,它将 mousemove 事件附加到菜单,以便当用户上下移动鼠标时,菜单滚动,允许他们看到隐藏的项目。就像这样:

alt text

(打印屏幕不会捕获指针,但在左侧屏幕上,它位于菜单顶部,在右侧屏幕上,它位于底部)

当层次结构中的最后一个菜单与上面一样太长时,此方法有效,但是,如果层次结构中的上一级菜单太长,则由于已应用溢出:隐藏,因此不会显示其子菜单.

所以,我的问题是...是否有另一种方法可以在不使用溢出:隐藏的情况下实现此效果(或者我可以以更好的方式使用它)?

或者,是否有更合适的 jQuery 插件可以让我做类似的事情?

如果您需要任何进一步说明,请告诉我。谢谢负载。

最佳答案

Someone else already answered something like this :

This type of control is seen all too often in corporate applications: drop-down controls and lists that contain thousands of entries.

Some programmers just use a hammer for screws.
(source: mac.com)

Programmers who mistakenly use it generally get a hint that it might be inappropriate when they find out that it takes an extraordinarily long time to load the form.

The following message, posted in a Visual Basic programmers forum on December 11, 1996, is typical:

I want to fill a list box with 2000 items ... This takes incredibly long ... over 20 minutes. Any ideas?

And another posted on December 16th, 1996, is somewhat less typical:

I'm looking for a list box control that can ... hold large numbers of entries (20,000+)

The excuse for such unwieldy controls is often a misguided interpretation of the almighty call to arms, "We must ensure data integrity." The programmers want to make sure that the user specifies a valid entry; in their view, the best way to do this is to force the user to select from a list. That would be fine if you had, say 20, 60, or maybe even 100 items in the list. Beyond that number, the fact that the user can only scroll a handful of items at a time causes the control to become unwieldy.

你实际上做得还不错,但是我可以建议使用其他方法来做到这一点吗?更多菜单?多步骤操作?

<小时/>

编辑

你现在有这样的结构:

Clients -> 
Letters of alphabet [A-Z] ->
Clients beginning with selected letter ->
Contracts belonging to selected client

如果我必须使用下拉菜单,我也会做同样的事情。

但是您可以制作一个带有“客户端”文本框/下拉框的弹出窗口(仅适用于少量客户端),并具有自动完成功能。

选择客户后,您将有一个搜索功能列表框(适用于小额),用于搜索属于该客户的所有契约(Contract)。您甚至可以按姓名、日期、号码等进行搜索。

一旦您选择并检查了该契约(Contract)就是您要查找的契约(Contract),按确定将导致与您执行的操作相同的操作。

当然,这在下拉菜单旁边似乎有点麻烦,但考虑到有了这么多的嵌套,“搜索”速度更快。

<小时/>

还有一件事:不要变成这样! :)

Window madness!
(来源:mac.com)

关于jquery - 使用 jQuery 和 jdMenu 插件创建多级可滚动菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1329527/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com