javascript - how to pass multi-array arguments to jquery for loop -



javascript - how to pass multi-array arguments to jquery for loop -

i want show overlays when hovering on items.

this code:

class="lang-html prettyprint-override"><div class="item" id="item-1"> <div class="overlay" id="overlay-1"></div> </div> <div class="item" id="item-2"> <div class="overlay" id="overlay-2"></div> </div> class="lang-js prettyprint-override">var items=["#item-1","#item-2"]; var overlays=["#overlay-1","#overlay-2"]; (var = 0; < products.length; i++) { $(items[i]).hover( function(){$(overlays[i]).css("visibility", "visible");}, function(){$(overlays[i]).css("visibility", "hidden");}); }

however, doesn't work... seams overlays[i] can't recognized...

why?

i this

$(".item").hover(function(){ $(this).find(".overlay").show(); });

javascript jquery html css

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -