2016-08-07 2 views
1

PHP로 fullpage.js를 사용하고 있습니다. 이 코드는 다음과 같습니다.JQuery 전체 페이지 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

작품, 덕분에 많이 !!!!!!! :) :) :) :) –