JQueryUI sortable lets you scroll and add delay for mobile devices

I have a built-in thumbnail gallery view that can be sorted using jQueryUI and the touch punch plugin for mobile devices.

Everything works fine, despite the fact that when there are a lot of images on mobile devices, I can’t scroll down to view more images because it sorts kicks in action.

Therefore, I can only move and sort those elements that are visible on the screen.

Therefore, I wondered whether it is possible to put a delay on the elements to be sorted, say, 2 seconds. Therefore, you need to touch and hold so that the li elements become active to move. Then I was wondering if it is possible to allow it to scroll through the thumbnail gallery, which will allow me to navigate through the list.

My code is:

$(function() { $( "#sortable" ).sortable({ delay: 900, scroll: true, placeholder: "ui-state-highlight" }); $( "#sortable" ).disableSelection(); }); 

The delay works, but still cannot scroll through the list of images without changing the order

Hope someone can help.

thanks

+6
source share
2 answers

Use "Bind" to create this jquery carousel, try this code as follows:

 $("#sortable").bind('swipeleft',function(event, ui){ }); 

Additional information http://learn.jquery.com/jquery-mobile/getting-started/

0
source

delay: millisecond

change the millisecond to the desired timeline before dragging

add this to the sorting setting

0
source

Source: https://habr.com/ru/post/947024/


All Articles