jquery 可拖动包含:表的子集
我怎样才能使收容成为细胞的子集。即省略标题行和最左边的列?
how can i make the containment to be a subset of cells. ie leaving out the header row and the leftmost column?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最佳方案是只发送一个选择器来选择应构成遏制的字段,但由于这行不通,所以我摆弄了一个替代解决方案。我不会说这是非常理想的,但我会尝试一下。
找到您应该拖动可拖动项的单元格的极值点(左、上、右、下),并将这些点设置为可拖动项的包含范围。在我的示例中,我为这些元素(表的
td
)指定了类containmentTD
。它没有考虑边框、填充等,因此如果这很重要,则需要对其进行调整。这是一个演示: http://jsfiddle.net/uTyTY/ 请注意,红色方块仅用于可视化收容区
The optimal would be to just send in a selector for the fields that should consitute the containment, but since that won't work I fiddled with an alternative solution. I wouldn't say it's very optimal but I'll give it a go.
Find the extreme points (left, top, right, bottom) of the cells that you are supposed to drag the draggable withing and set these points as the containment of the draggable. In my example I've given these elements (the
td
s of the table) the classcontainmentTD
. It doesn't take into account borders, padding ect so it'll need to be tweaked if that's important.Here's a demo: http://jsfiddle.net/uTyTY/ Note that the red square is only there to visualize the containment area