jQuery Sortable 可以在 IE/Chrome 中运行但不能在 Firefox 中运行,有什么原因吗?

发布于 2024-10-10 09:08:15 字数 863 浏览 0 评论 0原文

我有一个相当简单的水平浮动项目列表,如下所示:

<div class="my-widget-container">
    <div class="my-widget-column">...</div>
    ...
</div>

容器和每列都有固定宽度,使用 jQuery 的 .width() 设置。容器是position:relative,列是float: leftoverflow:hidden。不确定是否有任何其他样式/属性相关。

当我对此应用 jQuery-UI 可排序时,结果正是我在 Chome 8 和 IE 8 中所期望的;可以拖动列来更改其顺序。但在 Firefox 3.6 中,我可以单击一个项目并拖动以创建一个新的排序助手,但实际的排序从未发生;真实项目在 DOM 中的位置永远不会改变。

我在 Sortable 中进行了一些研究,并向 _intersectsWithPointer 添加了调试打印。每当拖动助手移动时,Sortable 都会遍历其元素列表,并使用此方法来确定拖动助手是否已越过一个元素。我看到的是 item.left 对于我的所有列都有相同的值,这显然是不正确的,并且可能是问题的根源。看起来所有列都有一个与第一列相对应的 left 位置。

我正在使用 jQuery 1.4.3 和 jQuery UI Sortable 1.8。这些不是最新版本,但它们是最近的版本,而且我在 Sortable 发行说明中没有看到任何表明此类问题已得到解决的内容。

有谁知道这里可能发生什么,或者有任何进一步调试的想法?

I have a fairly straightforward list of horizontally floated items, like this:

<div class="my-widget-container">
    <div class="my-widget-column">...</div>
    ...
</div>

Both the container and each column have a fixed width, set using jQuery's .width(). The container is position: relative and the column is float: left and overflow: hidden. Not sure if any other styles/properties are relevant.

When I apply a jQuery-UI sortable to this, the result is exactly what I'd expect in Chome 8 and IE 8; the columns can be dragged around to change their order. But in Firefox 3.6 I can click an item and drag to create a new sort-helper, yet the actual sort never happens; the real item's position in the DOM never changes.

I dug around a little in Sortable, and added a debug print to _intersectsWithPointer. Whenever the drag helper moves, Sortable runs through its list of elements and uses this method to determine whether the drag helper has passed over one. What I saw was that item.left had the same value for all my columns, which is obviously not correct, and probably the source of the problem. It looks like all columns had a left position corresponding to that of the first column.

I'm using jQuery 1.4.3 and jQuery UI Sortable 1.8. Those aren't the very latest versions, but they're pretty recent, and I don't see anything in the Sortable release notes that indicates any such problem has been fixed.

Does anyone know what might be happening here, or have any ideas for further debugging?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文