[jQuery] array problem
[jQuery] array problem
I'm trying to run the following code:
var nav = [ "#home", "#contact", "#gallery", "#about" ];
$(document).ready(function(){
for(var i = 0; i < nav.length; i++){
$(nav[i]).mouseover(function(){
$(nav[i]).animate({
marginTop: "-5px"
});
});
$(nav[i]).mouseout(function(){
$(nav[i]).animate({
marginTop: "0px"
});
});
}
});
however, those effects never get added. If I don't do the for loop
and do each item individually it works fine. Do I just have a dumb
bug in here?
Thanks for any help, and thanks for developing this great lib.