Я думаю, я понял это сейчас, вот что-то, что должно сортировать ваши элементы без плагина.
FIDDLE
var ul=$("#ordenar");
function sortList(ul, order) {
var list=ul.children("li").get();
switch(order) {
case 'id' :
list.sort(function(a, b) {
var compA = $(a).attr('id'), compB = $(b).attr('id');
return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
});
$.each(list, function(idx, itm) { ul.append(itm); });
break;
case 'class=True' :
list.sort(function(a, b) {
var compA = $(b).children(':first').attr('class'),
compB = $(a).children(':first').attr('class');
return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
});
$.each(list, function(idx, itm) { ul.append(itm); });
break;
case 'class=False' :
list.sort(function(a, b) {
var compA = $(a).children(':first').attr('class'),
compB = $(b).children(':first').attr('class');
return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
});
$.each(list, function(idx, itm) { ul.append(itm); });
break;
case 'one-up' :
$.each(list, function() {
if ($(this).children(':first').hasClass('checkTrue')) {
var prev = $(this).prev();
if (prev.length&&prev.children(':first').hasClass('checkFalse')) {prev.before($(this));}
}
});
break;
case 'one-down' :
$.each(list, function() {
if ($(this).children(':first').hasClass('checkTrue')) {
var next = $(this).next();
if (next.length&&next.children(':first').hasClass('checkFalse')) {next.after($(this));}
}
});
break;
}
}
Затем прикрепите некоторые идентификаторы на эти <a>
элементов и привязывайте щелчки, используйте protectDefault, если у вас есть проблемы с перепрыгиванием окна вверх или другие проблемы с якорями.
$("#refresh").on('click', function() {sortList(ul, 'id');});
$("#to_top").on('click', function() {sortList(ul, 'class=True');});
$("#to_bot").on('click', function() {sortList(ul, 'class=False');});
$("#once_up").on('click', function() {sortList(ul, 'one-up');});
$("#once_down").on('click', function() {sortList(ul, 'one-down');});