i came up with this code and found out that in the first load of image, the transition works fine but at the second time, the transition will not appear.
var imgIndex = 0;
SlideImages();
function SlideImages()
{
$("<img />").attr("src",theImages[imgIndex]).attr("style","display:none;").load(function(){
$(this).appendTo("div.picCon");
$(this).show("<?php echo $portfolioTransition; ?>",<?php echo $effectDuration; ?>,function(){
setTimeout( hideImg,2000);
});
});
}
function hideImg()
{
$("div.picCon img:visible").fadeOut(function(){
$("div.picCon").empty();
imgIndex = (imgIndex<theImages.length)?imgIndex+1:0;
SlideImages();
});
}
where the $portfolioTransition = "bounce"; $effectDuration = 1000;
is there any method that will execute if the image is in the cache already? or is there any alternative way so that my code below will work.. :)
i got this to work in safari but not in chrome..
function SlideImages()
{
$("<img />").attr("src",theImages[imgIndex]).attr("style","display:none;").one("load",function(){
$(this).appendTo("div.picCon");
$(this).show("<?php echo $portfolioTransition; ?>",<?php echo $effectDuration; ?>,function(){
setTimeout( hideImg,2000);
});
}).each(function(){
if(this.complete)$(this).trigger("load");
});
}