我怎么能修改此算法,重新安排一个< UL>?算法、我怎么能、LT、UL

2023-09-11 02:27:45 作者:染指旳沵唇

背景

我问这个问题昨天:

How修改的取向< UL> 跨越多列

询问如何列表转换是这样的:

asking how to convert a list like this:

a  b  c

d  e  f

g  h  i

j  k  l

到像这样的列表:

into a list like this:

a  e  i

b  f  j

c  g  k

d  h  l

和我得到这个的真棒的由 beeflavor 回应: http://jsfiddle.net/H4FPw/12/

and I got this awesome response by beeflavor: http://jsfiddle.net/H4FPw/12/

问题:

不幸的是我没有具体说明,有可能是任何数量的列表项,那么他的反应是硬coded到4行,使用一个棘手的矩阵算法(阅读:魔法),我不能环绕我的头。

Unfortunately I didn't specify that there could be any number of list items, so his response is hard-coded to 4 rows, and uses a tricky matrices algorithm (read: black magic) that I can't wrap my head around.

我戳以及刺激在这,尝试添加变性,但遗憾的是它不来在一起对我来说,今天是截止日期为这种东西。

I'm poking and prodding at this, trying to add variability but unfortunately it's not coming together for me and today's the deadline for this stuff.

这是我遇到的问题的最新例子: http://jsfiddle.net/H4FPw/ 13 /

This is an updated example of the problem I'm having: http://jsfiddle.net/H4FPw/13/

有没有人在那里,这个东西谁可以给我一个转向在正确的方向更好的头上?

Is there anyone out there with a better head for this stuff who can give me a steer in the right direction?

推荐答案

我知道这是不是因为优雅在这个问题你接受的答案,但the 我联系code在my回答昨天确实工作完美地为您提供:

I know it's not as "elegant" as your accepted answer in that question, but the code I linked to in my answer yesterday does work perfectly for you:

http://jsfiddle.net/AcdcD/

如果不需要处理调整大小,它可以稍微简化:

If you don't need to handle resizing, it can be simplified slightly:

http://jsfiddle.net/AcdcD/1/

也许你可以使用这个,如果你运行的时间?

Maybe you can use this if you run out of time?