PHP:
var GALLERY =
{
container: '#gallery',
url: '../chapter_06/08_ajax_image_gallery_improved/getImages',
delay: 5000,
load: function()
{
var _gallery = this;
jQuery.ajax(
{
type:"get",
url: this.url,
beforeSend: function()
{
jQuery(_gallery.container)
.find('img')
.fadeOut('slow', function()
{ jQuery(this).remove(); });
},
success: function(data)
{
var images = data.split('|');
jQuery.each(images, function()
{ _gallery.display(this); });
},
complete: function() {
setTimeout(function()
{
_gallery.load();
},
_gallery.delay);
}
});
},
display: function(image_url)
{
jQuery('<img></img>')
.attr('src', '../images/' + image_url)
.hide()
.load(function()
{
jQuery(this).fadeIn();
})
.appendTo('#gallery');
}
}
jQuery(document).ready(function(){
GALLERY.load();
});
Il codice sopra postato sembra funzionare con jquery 1.4.
Come potrei convertire il tutto per jquery 1.5 o 1.6..
Utilizzando firebug e quidi firefox mi da:
data.split is not a function
Ultima modifica: