Fullpage.js: Next and Previous buttons

I have two buttons: #btn1 and #btn2 ; and I want them to go back and forth when pressed. So #btn1 should go to the previous slide, and when I #btn2 , it goes to the next slide.

I am using fullPage.js for slides.

The documentation says that I should use this

 $.fn.fullpage.moveSlideUp(); $.fn.fullpage.moveSlideDown(); 

But I'm an amateur with Javascript . Can you help me?

+7
source share
1 answer

Just add this:

 $('#button1Id').click(function(){ $.fn.fullpage.moveSectionDown(); }); $('#button2Id').click(function(){ $.fn.fullpage.moveSectionUp(); }); 

And it is better to also use the fixedElements option in the case.

 $.fn.fullpage({ fixedElements: '#button1Id, #button2Id' }); 


UPDATE


If you are using fullpage.js 2.X, you do not need to use the fixedElements option. Just using the shell for the plugin and placing fixed elements outside the shell will work fine if you add a fixed style to your CSS.

Online example

+18
source share

All Articles