jQuery ui Sortable是否可以像gridster一样运行? [英] Can jQuery ui Sortable behave like gridster?

查看:83
本文介绍了jQuery ui Sortable是否可以像gridster一样运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能使 jQuery ui Sortable网格表现得像

Is it possible to get jQuery ui Sortable grid to behave like gridster?

为什么不使用gridster?因为它不能在IE9或更高版本上运行.

Why not use gridster? Because it doesn't work on anything less than IE9.

查看jQuery ui Sortable示例,如果将数字5拖动到数字1,数字1将向右移动.当我对gridster进行相同的操作时,数字1将移至数字5的位置.即使使用不同大小的元素,它也可以继续工作.

Looking at the jQuery ui Sortable sample, if you drag number 5 to number 1, number 1 moves to the right. When I do the same action with gridster, number 1 would move to number 5's position. It continues to work even with different sized elements.

是否可以使jQuery ui Sotables网格以类似方式工作?

Is it possible to get jQuery ui Sotables grid to work in a similar manner?

推荐答案

很难. jQuery的所有sortable行为都是更改父元素内元素的顺序.该演示中显示的网格行为"只是浏览器的布局引擎正常运行(将元素从左到右放置在父元素的width上,然后从上到下放置).另一方面,gridster会模拟一个依赖于其元素的网格:即使您从一列中删除了所有图块,它仍会占据屏幕上的空间.列上的元素是有序的,但可以根据需要添加/删除行.

Hardly. All jQuery's sortable does is change the order of elements inside the parent element. The "grid behavior" showed in that demo is just the browser's layout engine behaving normally (placing elements from left to right while they fit on parent's width, then top to bottom). gridster on the other hand simulates a grid that independs on its elements: even if you remove all tiles from one column, it still occupies space on screen. Elements on columns are ordered, but rows are added/removed as needed.

完全复制该行为将需要大量工作.我最接近 gridster演示的行为是

Replicating that behavior fully would be a lot of work. The closest I could get to the gridster demo's behavior is the connect lists example, which you can style like a grid (example) but having every element of the same size.

这篇关于jQuery ui Sortable是否可以像gridster一样运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆