You can try this -
$("ul li").each(function (index,element) {
$("ul li:nth-child(" + index + "n)").css("top", index * 30 + "px");
});
Or better
$("ul li").each(function (index,element) {
$(this).css("top", index * 30 + "px");
});