[jQuery] Help- jquery Dynamic Image load - dbl click = loads twice

[jQuery] Help- jquery Dynamic Image load - dbl click = loads twice


I have cobbled together an image loading script similar to lightbox but loads
into a specific div and now overlay. The problem - if you double click or
triple click on a thumbnail you get 2 or 3 of the same image loading.
Solution - I need something that checks to see if the same image is loading
or already loaded and if it is - do nothing. You can see an example here -
http://jwillis.net/v2/galleries/landscapes.shtml
http://jwillis.net/v2/galleries/landscapes.shtml
Any help would be most appreciated!
Thanks,
Tobias
$().ready(function()
{
//hides the div holding the loading graphic
$("#loaderdiv").hide();
$("#imageOptions a").bind("click", function()
{
//here is where I figured a slight mod to add the /large folder
var imageSource = $(this).children("img").attr("src");
$("#loaderdiv").show();
var newimageSource = imageSource.replace("/small/", "/large/");
$("h4").remove();
//for testing purposes
var checkimage = newimageSource;
//console.debug(checkimage);
//Checking done
showImage(newimageSource);
//was
return false;
//return checkimage;
});
});
function showImage(src) {
$("#loader img").fadeOut("normal").remove();
var largeImage = new Image();
$(largeImage).load(function() {
$(this).hide();
$("#loader").append(this);
//$("#loader").append("hello world");
$("#loaderdiv").fadeOut("fast").hide();
$(this).fadeIn("slow");
//window.alert(newimageSource.src + ' ' + newimageSource.width + ' x ' +
newimageSource.height);
});
//More checking!
//console.debug(src);
//console.debug(checkimage);
$(largeImage).attr("src", src);
}
--
View this message in context: http://www.nabble.com/Help--jquery-Dynamic-Image-load---dbl-click-%3D-loads-twice-tp22607358s27240p22607358.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.