I have a problem with looping over loading images:
var m = ["http://localhost:801/grillduck/img/mark1.jpg", "http://localhost:801/grillduck/img/mark2.jpg"];
for (i = 0; i < m.length; i++) {
var img = $("<img />").attr('src', m[i]).load(function() {
console.log($(this).height());
console.log($(this).width());
console.log(i); // PROBLEM here always return 2 instead of 0 then 1
var content = $('<div class="ho-content" id="demo-content' + i + '">');
});
}
problem is that I need to get the correct value of I for the loop in order to create div but it always return 2.
Cheerio, Mark