You should use the afterRender , which offers the fullpage.js plugin.
afterRender ()
This callback starts immediately after creating the page structure. This is the callback you want to use to initialize other plugins or to run any code that requires the document to be ready (since this plugin modifies the DOM to create the resulting structure).
You can see a live example here or you can even find it in the examples folder fullpage.js downloads.
And you can easily see the source code using it:
$(document).ready(function () { $('#fullpage').fullpage({ verticalCentered: true, sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE'], afterRender: function () {
UPDATE
This is no longer needed in fullpage.js> 2.6.6. It will automatically play the video when accessing the section, if it has an autoplay tag:
<video autoplay loop muted controls="false" id="myVideo"> <source src="imgs/flowers.mp4" type="video/mp4"> <source src="imgs/flowers.webm" type="video/webm"> </video>
If you want to play it only when loading a section (not on page loading), use data-autoplay . More details in the documentation .
source share