Hello,
I have cobbled together a loading script for large versions of the clicked thumbnails. If you double click the image loads twice- seen here http://jwillis.net/v2/galleries/recycled.shtml And actually if you are a super speedy clicker you can sometimes get 4 images loaded
I need some type of check/if statement that will see if it is all ready loading the existing image - I don't know how to go about this though.
Code:
$().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/");
$("h3").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);
$("#loaderdiv").fadeOut("fast").hide();
$(this).fadeIn("slow");
});
//More checking!
console.debug(src);
console.debug(checkimage);
$(largeImage).attr("src", src);
}
Any help you all can provide would be most appreciated.
Thanks!