jQuery: Wie finde ich heraus, wenn next () das Ende erreicht, dann gehe zum ersten Punkt

Ich bin anzeigen einer Reihe von Elementen mit Hilfe der next () - Funktion. Sobald ich das Ende zu erreichen, obwohl, ich möchte gehen auf das erste element. Irgendwelche Ideen?

Hier der code:

//Prev /Next Click
$('.nextSingle').click( function() {
    //Get the height of the next element
    var thisHeight = $(this).parent().parent().parent().next('.newsSingle').attr('rel');
    //Hide the current element
    $(this).parent().parent().parent()
        .animate({
            paddingBottom:'0px',
            top:'48px',
            height: '491px'
        }, 300) 
        //Get the next element and slide it in      
        .next('.newsSingle')
        .animate({
            top:'539px',
            height: thisHeight,
            paddingBottom:'100px'
        }, 300);
});

Im Prinzip brauche ich eine "if" - Anweisung, die sagt "wenn es keine verbleibenden "weiter" - Elemente, dann finden Sie das erste.

Dank!

InformationsquelleAutor der Frage j-man86 | 2010-08-28

Schreibe einen Kommentar