2016-08-07 13 views
1

私はPHPでfullpage.jsを使用しています。私はこのコードを持っています:JQuery Full Page JS

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

    // changeNav(nextIndex); 
}} 

インデックスに基づいてアンカーの内容を警告する必要があります。私はどのようにわからない。私は$('anchors')[0]を試しましたが、動作しませんでした。 ありがとうございます。

答えて

1

ただ、この操作を行います。魔法のように

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

作品、おかげで多くのことを!!!!!!! :) :) :) :) –