Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tag: 1.3
Fetching contributors…

Cannot retrieve contributors at this time

156 lines (153 sloc) 6.277 kb
<!DOCTYPE html>
<html lang="en-GB" dir="ltr">
<title>jQuery Video Background plugin</title>
<meta charset="utf-8">
<link href="themes/ui-darkness/jquery-ui-1.8.12.custom.css" rel="stylesheet" media="screen">
<link href="themes/jquery.videobackground.css" rel="stylesheet" media="screen">
* Page specific styling.
body {
margin: 0;
font-family: arial, helvetica, sans-serif;
a {
color: #FFF;
h2 {
font-size: 20px;
font-weight: normal;
li {
list-style: none;
dl {
dt {
float: left;
width: 160px;
dd {
margin: 0 0 10px 160px;
* If developing a full page background the styles from .video-background will be required.
* The classname itself is unimportant.
.video-background {
position: absolute;
top: 0;
left: 0;
overflow: hidden;
width: 100%;
height: 100%;
z-index: 0;
.video-background video {
min-height: 100%;
#page {
position: relative;
z-index: 1;
width: 960px;
color: #FFF;
background: transparent url(themes/background.png) repeat top left;
border-radius: 5px;
margin: 0 auto;
#main {
padding: 10px;
margin: 10px 0;
<script src="external/jquery.js"></script>
<script src="script/jquery.videobackground.js"></script>
$(document).ready(function() {
$('h2').bind('click', function(event) {
$(this).next('dl').slideToggle(500, function() {
$('body').prepend('<div class="video-background"></div>');
videoSource: [['video/big-buck-bunny.mp4', 'video/mp4'],
['video/big-buck-bunny.webm', 'video/webm'],
['video/big-buck-bunny.ogv', 'video/ogg']],
controlPosition: '#main',
poster: 'video/big-buck-bunny.jpg',
loadedCallback: function() {
<div id="page">
<div id="page-group">
<div id="header" class="header" role="banner" >
<div id="content">
<div id="main" role="main">
<h1>jQuery Video Background plugin</h1>
<p>Code available for download on <a href="">Github</a>.</p>
<p>Example of the jQuery Video Background plugin. Will place a resizable video in to the background of the page or designated element. Browsers that don't support the HTML5 video element will get an image if a poster image was provided.</p>
<p>If the containing element's width and height does not match the aspect ration of the video, the video will not alter it's aspect ratio but will render based on the largest dimension.</p>
<h2><a href="#">Public methods</a></h2>
<dd>Trigger a play/pause event on the chosen video background. Will play if the video is already paused. Will pause if the video is already playing.</dd>
<dd>Trigger a mute/unmute event on the chosen video background. Will unmute if the video is already muted. Will mute if the video is unmuted.</dd>
<dd>Will destroy the chosen video background. Unbinds events bound when the video background is initialised and removes HTML attached to the DOM by the plugin. If a controlPosition parameter is set this will also have to be set to safely remove all HTML elements from the DOM.</dd>
<dd>When invoked this will resize the video background to the height of the document or window. The video background height affects the height of the document which affects the video background's ability to negatively resize.</dd>
<h2><a href="#">Plugin parameters</a></h2>
<dd>Either an array of strings of video URL's or a two-dimensional array containing video URL's and type. No default.</li>
<dd>The URL string of the image used for the video poster attribute. No default.</dd>
<dd>Video autoplay attribute boolean. Default is true.</dd>
<dd>Video prelod attribute string. Default is none.</dd>
<dd>Video loop attribute boolean. Default is false.</dd>
<dd>Position of the video controls, will append the controls to choose DOM element. Default is null. If null will append controls to the element the video background has been applied to.</dd>
<dd>An array of text options for the video control elements.</dd>
<dd>Boolean which will trigger the video background to resize to match the browser height. Set to false is video background is used on another element. Default is true.</dd>
<dd>If required, a user controlled HTML string can be injected in to the control area of the page while the video is preloading. It will be over written by the video controls when the video is ready to play.</dd>
<dd>Allows a function to be triggered when the video preload is initiated.</dd>
<dd>Allows a function to be triggered when the video is loaded.</dd>
<dd>Allows the video background to resize to either the document or the window. Default is document.</dd>
<p>Video trailer from <a href=""></a>. An open source <a href="">Blender</a> project.</p>
<p>Please use the <a href="">GitHub issue tracker</a> for bug reports and feature requests.</p>
<div id="aside" class="aside" role="complementary">
<div id="footer" class="footer" role="contentinfo">
Jump to Line
Something went wrong with that request. Please try again.