[jQuery] .each - how to write in my code?
Hello,
I am very new to jQuery and don´t know how to write my code for every
item.
Here is my code for a list with hover functions, I would like for
every item to be processed separately. I know about a functio that is
written ".each", but can´t seem to get it to work.
-------
<script type="text/javascript">
$(function() {
// set opacity to nill on page load
$("ul#menu span").css("opacity","0");
$("ul#menu li").each(function () {
// on mouse over
$("ul#menu a").hover(function () {
// animate opacity to full
$('ul#menu span').stop().animate({
opacity: 1
}, 'slow');
},
// on mouse out
function () {
// animate opacity to nill
$('ul#menu span').stop().animate({
opacity: 0
}, 'slow');
});
});
});
</script>
-------
hope someone has some answers or a book to recommend for a newbie.
Regards
/adesign