Bonjour à tous,
j'ai récupéré le code jQuery
scrollpagination . Cela fonctionne parfaitement pour charger une page, mis j'aurais besoin d'en charger plusieurs... Ou de charger une seule page mais en plusieurs morceaux, par exemple toutes les 5 cinq ou 10 photos...
Voici la fonction :
Code Javascript :
$(function(){
$('#content').scrollPagination({
'contentPage': 'democontent.html', // the page where you are searching for results
'contentData': {}, // you can pass the children().size() to know where is the pagination
'scrollTarget': $(window), // who gonna scroll? in this example, the full window
'heightOffset': 1, // how many pixels before reaching end of the page would loading start? positives numbers only please
'beforeLoad': function(){ // before load, some function, maybe display a preloader div
$('#loading').fadeIn();
},
'afterLoad': function(elementsLoaded){ // after loading, some function to animate results and hide a preloader div
$('#loading').fadeOut();
var i = 0;
$(elementsLoaded).fadeInWithDelay();
if ($('#content').children().size() > 1){ // if more than 100 results loaded stop pagination (only for test)
$('#nomoreresults').fadeIn();
$('#content').stopScrollPagination();
}
}
});
// code for fade in element by element with delay
$.fn.fadeInWithDelay = function(){
var delay = 0;
return this.each(function(){
$(this).delay(delay).animate({opacity:1}, 500);
delay += 500;
});
};
});
</script>
Comment pourrais-je obtenir le chargement d'une autre page, ou le chargement d'une seule page scindée (ici 'democontent.html')?
Cela fait des heures que je cherche et je ne comprends rien ou pas grand chose à tout ce javascript... Au secours !!
Merci d'avance !!
Ben