[jQuery] closures and for loop question, NS_ERROR_XPC_BAD_CONVERT_JS
JQuery users,
I'm receiving the following error:
Error: [Exception... "Could not convert JavaScript argument arg 0
[nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80570009
(NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame ::
http://REMOVED.net/jquery-1.2.6.min.js :: anonymous :: line 22" data:
no]
Source File: http://REMOVED.net/jquery-1.2.6.min.js
Line: 22
When I run this code:
$(function () {
var imgs = $("div").filter(".fc_Picture");
var parentDiv;
for(i=0; i<imgs.length; i++) {
var img = new Image();
parentDiv = imgs[i];
$(img)
.load(function(parentDiv,image) {
return function() {
$(image).hide()
$(parentDiv).removeClass('fc_loader');
$(parentDiv).append(image);
$(image).fadeIn();
}(parentDiv,image);
})
.attr('src','fc_image.php?imageid='+$(imgs[i]).attr
('id').split("_")[2])
.attr('width','50')
}
});
What I'm trying to do is have a set of images and each one loads with
one of those cute little loader swirl things. I understand the
pitfalls of for loops and closures (after much head scratching) but I
still can't get it to work and to be honest I haven't the faintest
what that error message means.
Thanks for your help
Joel