user20072008
user20072008

Reputation: 379

jQuery Mobile Sortable with swiperight

I am trying to use jquery sortable to move li items. I also want to use swiperight event on the same li items but whenever i try to swipe right, li item removes from the list and event does not fire.

Can someone suggest how can I achieve this ?

<ul id="tree">
    <li>first</li>
    <li>second</li>
    <li>third</li>
    <li>fourth</li>
</ul>

http://jsfiddle.net/84rrK/1/

Upvotes: 0

Views: 319

Answers (1)

Cheryl Miller
Cheryl Miller

Reputation: 66

It was happening to me also. Both the sortstop function and the swipe function were firing when swiping the list item. Here's what I did:

$( "#sorted-list" ).bind( "sortstop", function(event, ui) {

if (Math.abs(ui.offset.top - ui.originalPosition.top)>35){
    var listOrder = $(this).sortable('toArray').toString();
    $.post('whatever.cfc',method:'sortStuff',ListOrder:listOrder}); 
}

})

This way, if it is a drag-n-drop up or down, it will sort.

Upvotes: 1

Related Questions