Non avevo mai avuto questa esigenza, ma credo che questo sembra funzionare:
codice:
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(function() {
$('li').hover(function() {
console.log($(this).prevAll().length);
}, function() {});
});
</script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
</style>
</head>
<body>
<ul>[*]1[*]2[*]3[*]4[*]5[*]6[/list]
</body>
</html>
Qui lo puoi vedere in funzione:
http://jsbin.com/afiqo4/edit
Ciao