Hi I'm trying to use addClass in a img inside the li, and I try to get the depth with a variable for be use in :eq() of the next way, but doesn't work, but if change my depth variable for a simple data inside the :eq, works it, but I can't do it this way because, all images change the class, I need just change the image inside the li.
Thanx for your help !
this is the html
<ul id="MenuItemsZavaSocial">
<li class="offPicture"><img class="offPos" src="images/diabeticos.jpg" /></li>
<li class="offPicture"><img class="offPos" src="images/mujer.jpg" /></li>
<li class="offPicture"><img class="offPos" src="images/medioAmbiente.jpg" /></li>
</ul>
this is the event
$('#MenuItemsZavaSocial li').hover(
function(){
var depth = this.index();
$(this).addClass('onPicture');
$('#MenuItemsZavaSocial li:eq(depth) img').addClass('onPos');
},
function(){
$(this).removeClass('onPicture');
$('#MenuItemsZavaSocial li:eq(depth) img').removeClass('onPos');
}
);
but works it if I put something like this
$('#MenuItemsZavaSocial li:eq(0) img').addClass('onPos');
Why !!!!!!!!!!!
I'm going to crazyyy !!!! :(