Vitrex
Moderator
hello, emudevs, heh does anybody can help me solve second problem. i have 2 div elements features_box
they both have different id
features_box_1
features_box_2
so when you click on them i wanna show one more div above them,this works fine if i write code for each box manually, but i wanna make it through loop, since i'm and jquery are enemies long time ago, i can't get loop working, it's shows only the last one box data. doesn't matter on which i click it show only the last one;
here is my code
maybe i use wrong loop?
they both have different id
features_box_1
features_box_2
so when you click on them i wanna show one more div above them,this works fine if i write code for each box manually, but i wanna make it through loop, since i'm and jquery are enemies long time ago, i can't get loop working, it's shows only the last one box data. doesn't matter on which i click it show only the last one;
here is my code
Code:
for (var iter = 0; iter<=2; iter++){
var container =$('#features_box_'+iter);
var content =$('#features_content_'+iter);
$(container).click(function( event) {
$(content).slideDown();
$(container).mouseleave(function( event ) {
$(content).slideUp();
});
});
}
maybe i use wrong loop?