你应该使用fullpage.js插件提供的
afterRender回调.
afterRender()
This callback is fired just after the structure of the page is generated. This is the callback you want to use to initialize other plugins or fire any code which requires the document to be ready (as this plugin modifies the DOM to create the resulting structure).
您可以查看实时示例here,或者甚至可以在fullpage.js下载的the examples folder中找到它.
您可以轻松查看其使用的源代码:
$(document).ready(function () {
$('#fullpage').fullpage({
verticalCentered: true,sectionsColor: ['#1bbc9b','#4BBFC3','#7BAABE'],afterRender: function () {
//playing the video
$('video').get(0).play();
}
});
});
UPDATE
在fullpage.js>中不再需要这样做. 2.6.6.
只要在其中包含标签自动播放,它将在访问该部分时自动播放视频:
如果您只想在部分加载(而不是页面加载)上播放它,请使用data-autoplay.
更多信息at the documentation.