2016-08-07 9 views
1

Ich benutze fullpage.js mit PHP. Ich habe diesen Code:JQuery Full Page JS

$('#fullpage').fullpage({ 
anchors: ['homepage', 'aboutmepage'], 
menu: '#menu', 
onLeave: function(index, nextIndex, direction){ 
    ALERT anchors[1] here! 

    // changeNav(nextIndex); 
}} 

Ich muss den Inhalt der Anker basierend auf einem Index warnen. Ich weiß nicht wie. Ich habe versucht $('anchors')[0], aber es hat nicht funktioniert. Vielen Dank im Voraus.

Antwort

1

Genau dies tun:

onLeave: function(index, nextIndex, direction){ 
    //anchor of the leaving section 
    alert($(this).attr('data-anchor')); 

    //anchor of the destination section 
    alert($('.fp-section').eq(nextIndex - 1).attr('data-anchor')); 
} 
+0

funktioniert wie Charme, vielen Dank !!!!!!! :) :): :) –