Please please someone put me out of my misery....i have poured hour upon hour into this...
I have (this is abbreviated) been creating a function which adds boxes to a page using append. The problem is once they have been added the fadeIn function doesnt work. It will work however if i hard code the element to the page:
Here is my javascript:
//Loop through the images and print them to the page
for (var i=0; i < totalBoxes; i++){
//$("p").add(arr).appendTo('#bg');
$.ajax({
url: "random.php?no=",
cache: false,
success: function(html){
$(html).fadeIn(html).appendTo('#bg');
}
});
}
//Choose the image to be faded in
$(".pf-box img").hover(function(){
var largePath = $(this).attr("rel");
$(this).fadeOut("slow", function() {
$(this).attr({ src: largePath }).fadeIn("slow");
});
return false;
});
the random.php literally prints however many boxes...here is a printed sample:
<div class="pf-box" style="">
<a href="#">
This is where the image is printed with the rel attribute on the image tag. (stackoverflow didnt allow the posting of the img tag because its my first post)
</a>
</div>