Quelqu'un pourrait-il m'aider à comprendre comment précharger les images de la page random.php afin que la première fois qu'il les charge se fane comme il se doit. À l'heure actuelle son obtenu un écho en vrac laid parce qu'ils ne sont pas préchargés, mais une fois que la page a été exécutée une fois qu'il se fane sur après l'autre parfaitement ...Précharger des images à partir d'un appel Ajax
//Loop through the images and print them to the page
for (var i=0; i < totalBoxes; i++){
$.ajax({
url: "random.php?no=",
cache: false,
success: function(html) {
// following line I originally suggested, but let's make it better...
//$('#bg').append(html).fadeIn('slow');
// also note the fine difference between append and appendTo.
var $d = $(html).hide().appendTo('#bg').fadeIn('slow');
$('img', $d).hover(function() {
var largePath = $(this).attr("rel");
$(this).fadeOut("slow", function() {
$(this).attr({ src: largePath }).fadeIn("slow");
});
});
}
});
}
Grand plug-in utile! +1 – alex
Hey mec, j'ai utilisé votre plugin et cela m'a causé au moins un comportement inattendu. Voir cette question: http://stackoverflow.com/questions/3050111/attention-javascript-gurus-need-a-hand-with-setinterval – alex