2012-04-15 32 views
3

私はjquery ui sortableを使用しています。ウインドウスクロールがなければ、私のソート可能なアイテムは機能し、閉じ込めにとどまります。 しかし、ウィンドウをスクロールしてアイテムをソート可能にすると、アイテムは最初にウィンドウスクロールと同じ高さに移動し、マウスポインタにはそれ以上固執しません。 私は間違っていましたか?あなたの助けのためのjQuery UI Sortable Window Scroll

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

これを今までにやめましたか?私はまったく同じ問題を抱えています:( –

+0

私はこの問題も解決していませんが、誰かのために働く可能性のあるいくつかの潜在的な解決策を使ってjQueryボードに関するこのディスカッションを見つけました:https://forum.jquery.com/topic/ソート可能なオフセット要素の場合は、ドラッグ&ページスクロールダウンff – igneosaur

+0

ここで別の質問:http://stackoverflow.com/questions/2451528/jquery-ui-sortable-scroll-helper-element- offset-firefox-issue – igneosaur

答えて

1

はあなたのリストの親/コンテナにoverflow: auto;を追加します。