1

我正面临 jQuery sortable 的下一个问题(在除 Firefox 之外的所有主要浏览器中都可以正常工作)

我有一个常见的 ul 结构,上面有 4 个 li 项目。al 列表显示和工作正常,您可以拖动项目(firefox)很酷,(我解决了溢出-y:auto;问题也)当您尝试将可拖动项目放到新位置时,问题开始,在 firefox 中, “放置区”不会出现,只有您可以拖动项目,我在几个帖子中进行了研究。

jQuery UI 可排序滚动辅助元素偏移 Firefox 问题 Firefox 4 jQuery UI 可排序 jquery ui 1.8.16 和 firefox 6 问题 - 可排序无法正常工作

但是我找不到解决方案,我将向您展示问题的外观。 在此处输入图像描述

我的css,我认为我必须修改如下方式:

#list-attributes{width:40%; margin:35px 15px 45px 10px; position:relative;  overflow-y:auto;}
#list-attributes li{background:#F7F7F7; padding:20px; color:#666; width:auto; border:1px solid #CCC; position:relative; text-indent:30px; height:25px}
#list-attributes li div.icon{width:25px; height:35px; background:url(../img/search/sprite_search_filters.png) no-repeat; right:0; margin-right:10px; top:18px; position:absolute;}
#list-attributes li div.getinshape{background-position: 0 -297px}
#list-attributes li div.rekindlespiritually{background-position: 0 -357px}
#list-attributes li div.relaxandunwind{background-position: 0 -417px}
#list-attributes li div.gethealthy{background-position: 0 -477px}
#list-attributes li span.msg{ text-indent:28px; line-height:1.8}
#list-attributes li div.handler{color:#666; width:25px; height:25px; background:#00C4D9 url(../../dashboard/frontend/img/drag.png) no-repeat 5px 5px; cursor:move; display:inline-block; position:absolute; top:15px; left:8px}

jQuery代码:

            $("#list-attributes").sortable({
                update : function () {
                     $('#attributeItems').val($('#list-attributes').sortable('toArray'));
                    //$("#info").load("process-sortable.php?"+order);
                }
            });
4

1 回答 1

1

好的,这就是答案,我想说这是一个很大的错误,我不知道为什么会发生。

在我的 css 文件中,我在 body 元素处

溢出-y:滚动;溢出-x:隐藏;

我刚刚将它从正文中删除并且可排序开始工作,但我还必须将溢出:自动添加到容器(通常是 ul)标签中。

这是一个非常“wtf”的错误,但我发现了它。希望将来有人面对这个问题可以解决它。如果您找到更好的方法,请告诉我。

于 2012-05-13T00:56:56.253 回答