backgroundVideo.js是一款jQuery视频背景插件。该jQuery视频背景插件能够在整个页面或指定的容器中,嵌入HTML5视频,并提供视频自动播放,视频预加载,无限循环等功能。
使用方法
在页面中引入jquery以及backgroundVideo.js文件。
<script src="jquery.min.js"></script> <script src="backgroundVideo.js"></script>
HTML结构
然后在页面中创建一个视频容器元素。
<div id="test-vedio"></div>
初始化插件
在页面DOM元素加载完毕之后,通过下面backgroundVideo()方法来初始化该jQuery视频背景插件。
$("#test-vedio").backgroundVideo({ mp4: "bg.mp4" });
该jQuery视频背景插件不仅支持mp4格式,还支持下面的视频格式。
$("#test-vedio").backgroundVideo({ mpeg: "path/to/mpeg-file", mp4: "path/to/mp4-file", webm: "path/to/webm-file", ogg: "path/to/ogg-file", quicktime: "path/to/quicktime-file", x_msvideo: "path/to/x-msvideo-file", m4v: "path/to/m4v-file", rtf: "path/to/rtf-file", });