jquery docs の内容に基づいて .each() がどのように機能するかについての基本的な理解がありますが、大量の要素を持つものにそれを適用する方法を本当に理解していません。SVG を使用して作成したマップがあります。現在、マップの各セクションは onmouseover 関数で点灯します。
$('.shape').mouseover(function(){
// $('.shape').css({fill:#5df8b8;})
shape_id = $(this).attr('id');
console.log($(shape_id));
$("#" + shape_id).css("fill", "#5df8b8");
$('.hidden').each(function(i){
//show each div on hover over
});
});
$('.shape').mouseleave(function(){
console.log("you left a zip");
$('.shape').css("fill", "white");
$('.hidden').hide();
});
マップの各セクションに div があります。エリアに関する情報を含む各 div。この場合、.each() よりも優れたものはありますか?