Created
September 14, 2010 19:15
-
-
Save malero/579596 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sortable-delete { | |
height: 18px; | |
overflow: hidden; | |
background: url('/resources/img/bin.png') 0 50% no-repeat; | |
} | |
#sortable-delete li { | |
height: 0; | |
width: 0; | |
overflow: hidden; | |
} | |
ul.sortable { | |
padding-bottom: 5px; | |
} | |
ul.sortable li { | |
cursor: pointer; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul id="sortable-delete" class="sortable"></ul> | |
<ul class="sortable"> | |
<li>Item 1</li> | |
<li>Item 2</li> | |
</ul> | |
<ul class="sortable"> | |
<li>Item 3</li> | |
<li>Item 4</li> | |
<li>Item 5</li> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function() { | |
// Make all ul.sortable lists into sortable lists | |
jQuery('ul.sortable').sortable({ | |
tolerance: 'pointer', | |
cursor: 'pointer', | |
dropOnEmpty: true, | |
connectWith: 'ul.sortable', | |
update: function(event, ui) { | |
if(this.id == 'sortable-delete') { | |
// Remove the element dropped on #sortable-delete | |
jQuery('#'+ui.item.attr('id')).remove(); | |
} else { | |
// Update code for the actual sortable lists | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment