在一切之前,ty忙帮助和 s解 no。
I have problem with event inside a for. The DOM is something like that:
<div class="wrap">
<div class="trigger">...</div>
<div class="trigger">...</div>
<div class="box">...</div>
<div class="box">...</div>
</div>
我的J. Query是:
for( i = 0; i < $( .trigger ).length; i++ ){
$( .trigger:eq( +i+ ) ).click(function(){
$( .box:eq( +i+ ) ).fadeIn();
});
$( .box:eq( +i+ ) .bt-close ).click(function(){
$( .box:eq( +i+ ) ).fadeOut();
});
}
Well, the problem is, when i click on trigger, the value of i is 2. I don t want to use trigger1, trigger2... because i do not know how many will have in the final version.