相关疑难解决方法(0)

处理重叠的jQuery可排序列表

这是一个不起眼的问题,但我正在使用jQuery Sortables并试图让两个连接列表很好地协同工作fixed.一切正常,直到你滚动页面,使两个列表最终位于彼此的顶部.然后列表似乎对哪一个应该接收被拖动的项目感到困惑,这意味着当每个列表中出现/消失时,会发生一堆抖动.

看起来问题是两个列表都在处理鼠标/排序事件,因为被拖动的项目在技术上是在两个列表上,但我想要的是让覆盖列表(即position: fixed一个)吞下事件以便底层主要列表不会尝试接收该项目.

这是最小的代码示例:

<html>
<head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script>
    <style type="text/css">
        ul { list-style-type: none; padding: 0; float: left; }
        li { margin: 5px; padding: 5px; width: 500px; border: solid 1px #F00; background-color: #FFF; }
        #overlayed { position: fixed; top: 0; background-color: #000; margin: 20px; padding: 10px; }
        #overlayed li { width: 50px; float: left; }
    </style>
    <script type="text/javascript">
        $(function() {
            $("ul").sortable({ connectWith: "ul", opacity: 0.6 }).disableSelection();
        });
    </script>
</head>
<body>
<div …
Run Code Online (Sandbox Code Playgroud)

javascript jquery drag-and-drop fixed jquery-ui-sortable

9
推荐指数
1
解决办法
6530
查看次数