Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>UPDATE</p> <p>since the sort event only fire when the user move his mouse you should use a function who check position of the helper every n milliseconds like this :</p> <p><a href="http://jsfiddle.net/Y2RJj/44/" rel="nofollow">edited jsFiddle</a></p> <pre><code> var timerId = 0; function testPos (l , h){ timerId = window.setInterval(function(){ var leftUl = l var ulTop = leftUl.offset().top; var ulBottom = ulTop + leftUl.height(); console.log(h.offset().top &gt;= ulTop &amp;&amp; h.offset().top &lt;= ulTop + 20) if(h.offset().top &gt;= ulTop &amp;&amp; h.offset().top &lt;= ulTop + 20 ){ leftUl.scrollTop(leftUl.scrollTop() - 1) } if(h.offset().top +h.height() &lt;= ulBottom &amp;&amp; h.offset().top +h.height() &gt;= ulBottom - 20 ){ leftUl.scrollTop(leftUl.scrollTop() + 1) } }, 10); } </code></pre> <p>and start the timer on start and clearInterval on stop</p> <pre><code>start : function (event , ui){ testPos ($('ul.static.sortable.connected-sortable') , ui.helper); }, stop: function( event, ui ) { clearInterval(timerId) ui.item.prev().children(".hint").hide(); var nextItemclass = ui.item.next().attr("class"); var prevItemClass = ui.item.prev().attr("class"); if ((nextItemclass == "sortableRow")&amp;&amp;(ui.item.parent().hasClass('static'))){ $(".right").append(ui.item.next()); } if ((prevItemClass == "sortableRow")&amp;&amp;(ui.item.parent().hasClass('static'))){ $(".right").append(ui.item.prev()); } if(prevItemClass == "not-sortable"){ ui.item.prev().addClass("highlight"); } }, </code></pre> <p>You can do this with the sort event</p> <pre><code>sort : function( event, ui ){ var leftUl = $('ul.static.sortable.connected-sortable') var ulTop = leftUl.offset().top; var ulBottom = ulTop + leftUl.height(); if(ui.offset.top &gt;= ulTop &amp;&amp; ui.offset.top &lt;= ulTop + 20 ){ leftUl.scrollTop(leftUl.scrollTop() - 1) } if(ui.offset.top +ui.helper.height() &lt;= ulBottom &amp;&amp; ui.offset.top +ui.helper.height() &gt;= ulBottom - 20 ){ leftUl.scrollTop(leftUl.scrollTop() + 1) } } </code></pre> <p><a href="http://jsfiddle.net/Y2RJj/43/" rel="nofollow">jsFiddle</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload