<ul tabindex='0' class='listy'>
<li class='muted'>elem 1</li>
<li>elem 2</li>
<li>elem 3</li>
<li>elem 4</li>
<li>elem 5</li>
<li>elem 6</li>
<li>elem 7</li>
<li class='muted'>elem 8</li>
<li>elem 9</li>
<li>elem 10</li>
</ul>
$('.listy').listy({
actions: {
select: {
keys: [13, 32],
events: 'click',
method: function(elem){
if (elem.hasClass('selected')){
elem.removeClass('selected');
$('#console').prepend(elem.text()+' deselected !
');
} else {
elem.addClass('selected');
$('#console').prepend(elem.text()+' selected !
');
}
}
},
remove: {
keys: [8],
events: 'dblclick',
method: function(elem){
elem.hide();
$('#console').prepend(elem.text()+' removed !
');
}
},
inactive: {
keys: [73],
method: function(elem){
elem.removeClass('selected listy-hover')
.addClass('muted')
.off('click dblclick');
$('#console').prepend(elem.text()+' inactived !
');
}
}
}
});