Multiple parallax video backgrounds

假如想象 提交于 2019-12-06 21:56:30

Ok i figuerd out the solution

You have to have differend video wrap ID for each of parallax video you want to display and then specify it in JS

HTML:

<div id="video-wrap1" class="video">
  <video id="my-video1" preload="metadata" autoplay loop>
    <source src="<?php echo get_template_directory_uri(); ?>/video/video1.mp4" type="video/mp4">
  </video>
</div>

<div id="video-wrap2" class="video">
  <video id="my-video2" preload="metadata" autoplay loop>
    <source src="<?php echo get_template_directory_uri(); ?>/video/video1.mp4" type="video/mp4">
  </video>
</div>
...

JS:

$(document).ready(function() {
$("#my-video1").backgroundVideo({$videoWrap: $('#video-wrap1')});
$("#my-video2").backgroundVideo({$videoWrap: $('#video-wrap2')});
...

Works as charm :)

The plugin has been updated to allow for multiple videos, check the example use: https://github.com/linnett/backgroundVideo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!