J
J
jkristo ‣2020-11-05 04:08:20
JavaScript
jkristo ‣, 2020-11-05 04:08:20

Jquery-Ui Sortable - sorts the list but doesn't scroll the page on iPad. How to make scrolling and sorting through delay?

I have a list in a sidebar and I apply "jQuery Ui Sortable" to it. for sorting goods.
https://api.jqueryui.com/sortable/

5fa34cec55e3a484649540.png

When I try to scroll a list on my iPad by swiping the screen and it hits a list item, instead of scrolling it starts dragging the item, the list sorts but fails to scroll.
I think there is an option in jQuery.sortable to control this. In the parameters somewhere:

$('.target-list').sortable({
    delay: 500,
    scroll: true,
   ...
   // сортируем тут если после задержки если по тачу delay > 500, или скролим если задержка не дождалась 500, 
  //  т.е. свайп обычный должен отрабатывать
})


When I press my finger on a draggable element on mobile, there should be a delay before it actually starts dragging.
I try like this but it doesn't work:

$('.target-list').sortable({
    delay: 500,
    scroll: true,
    items: '.unit',
    stop: function (e, ui) {
        $.post('/some_sourse/reorder', {
            order: $('.target-list .unit').map(function (i, el) {
                return $(el).data('id');
            }).toArray()
        });
    }
})

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question