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 overlay
s when hovering on item
s.
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
Post a Comment