2012-04-15 87 views
3

我正在使用jQuery UI可排序。没有窗口滚动我的可排序的项目工作,并留在遏制。 但是,如果我滚动窗口,我开始排序项目,我的项目首先移动到我的窗口滚动高度不再粘在我的鼠标指针! 我做错了什么?jQuery UI可排序窗口滚动

var purchased = []; 
$("#listitems").sortable({ 
    revert: true, 
    containment: '#drop', 
    stop: function(event, ui) { 
     purchased = []; 
     $("#listitems li").each(function() { 
      var elem = $(this); 
      var st = elem.attr('id'); 
      if (jQuery.inArray(st, purchased) == -1) { 
       purchased.push(st); 
      } 
     }); 
     console.log(purchased); 
    } 
}); 

    <div id="drop" class="clearfix" style="position:relative;margin:0 auto;min-height:160px;height:auto!important;height:160px;;margin-bottom:20px; border-top:1px solid #D4D4D4;border-bottom:1px solid #DADADA"> 
     <div style="position:absolute;top:-31px;left:10px; z-index:0"><h1 id="depose" style="font-size:2.6em; line-height:1em; color:#EBEBEB; font-weight:700; z-index:0">DRAG HERE</h1></div> 
     <ul id="listitems" style="position:relative;z-index:11" class="alt_content galerie-thumbs"> 
<li>image 1</li> 
<li>image 2</li> 
... 
     </ul> 
    </div> 

感谢您的帮助......

+0

你有没有怀疑过这一点?我有完全相同的问题:( – 2013-04-19 16:00:32

+0

我也有这个问题,没有解决方案,但我发现这个jQuery板上的讨论与几个可能的解决方案,可能有人工作:https://forum.jquery.com/topic/可排序偏移当元素被拖动和页面滚动向下ff – igneosaur 2015-12-29 03:56:03

+0

另一个问题在这里:http://stackoverflow.com/questions/2451528/jquery-ui-sortable-scroll-helper-element-胶印中的firefox-问题 – igneosaur 2015-12-29 04:07:19

回答

1

添加overflow: auto;到列表中的父/容器。