Skip to content

Instantly share code, notes, and snippets.

@mluton
Created February 18, 2012 00:30
Show Gist options
  • Save mluton/1856520 to your computer and use it in GitHub Desktop.
Save mluton/1856520 to your computer and use it in GitHub Desktop.
JQuery Sortable List with Grabby Hands (Webkit-Only)
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Sortable</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js"></script>
<style>
#list {
list-style: none;
}
#list li {
display: block;
width: 200px;
padding: 20px 10px;
margin-bottom: 5px;
background-color: #efefef;
}
#list li {
margin-right: 20px;
cursor: -webkit-grab;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$("#list").sortable({
start: function () {
$('#list li').css('cursor', '-webkit-grabbing');
},
stop: function () {
$('#list li').css('cursor', '-webkit-grab');
}
});
});
</script>
</head>
<body>
<ul id="list">
<li id="item_1">Item 1</li>
<li id="item_2">Item 2</li>
<li id="item_3">Item 3</li>
<li id="item_4">Item 4</li>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment