$(function() {
addVideoToSectionIfItIsPossible();
function addVideoToSectionIfItIsPossible(){
if(!Modernizr.video) return;
if($.browser.mobile) return;
var windowWidth = $(window).width();
function GetHtml5VideoElementByWidth(windowWidth){
var videoFileName,
html5VideoElement;
if(windowWidth <= 1280){
videoFileName = "medium";
}
else if(windowWidth <= 1600){
videoFileName = "large";
}
else {
videoFileName = "x-large";
}
html5VideoElement = "<video autoplay src=\"video/"
+ videoFileName + ".mp4\" loop></video>";
return html5VideoElement;
}
var html5VideoElement = GetHtml5VideoElementByWidth(windowWidth);
$('#intro').append(html5VideoElement);
}
});