You should be able to use the jQuery prepend()
function:
$('li.menu_category1').click(function(){
$('.category1').parent().prepend($('.category1'));
});
prepend()
and append()
will move existing elements.
You should also be able to improve this code, but I can't without knowing more of your code and html.