Reputation: 373
I am using fullpage.js with PHP. I have this code:
$('#fullpage').fullpage({
anchors: ['homepage', 'aboutmepage'],
menu: '#menu',
onLeave: function(index, nextIndex, direction){
ALERT anchors[1] here!
// changeNav(nextIndex);
}}
I need to alert the content of anchors based on an index. I don't know how. I've tried $('anchors')[0]
but it did not work.
Thanks in advance.
Upvotes: 1
Views: 121
Reputation: 41595
Just do this:
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') );
}
Upvotes: 1