Reputation: 38190
I'd like to use http://jqueryui.com/demos/sortable/
Will it be possible with jquery mobile ?
Upvotes: 1
Views: 585
Reputation: 629
I am sorry but the method in my previous answer it doesn't really work because the tap is captured for the scrolling.
I found this wonderful library which makes the trick: http://touchpunch.furf.com/
And a working example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Docs - Basic Lists</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" href="http://jquerymobile.com/demos/1.1.0/docs/_assets/css/jqm-docs.css"/>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://jquerymobile.com/demos/1.1.0/docs/_assets/js/jqm-docs.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script src="https://raw.github.com/furf/jquery-ui-touch-punch/master/jquery.ui.touch-punch.min.js"></script>
</head>
<body>
<div data-role="page" class="type-interior">
<div data-role="content">
<ul data-role="listview" class="sortable">
<li><a href="index.html">Acura</a></li>
<li><a href="index.html">Audi</a></li>
<li><a href="index.html">BMW</a></li>
<li><a href="index.html">Cadillac</a></li>
<li><a href="index.html">Chrysler</a></li>
<li><a href="index.html">Dodge</a></li>
<li><a href="index.html">Ferrari</a></li>
<li><a href="index.html">Ford</a></li>
</ul>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$( ".sortable" ).sortable();
});
</script>
</body>
</html>
But I'm afraid it won't work well for a long list on a small screen.
Upvotes: 1