$(function () { if (!($('body').hasClass('ismobile'))) { $('#header').addClass('semi-background'); video_index = Math.round(Math.random() * (videos.length-1)); $('.hero_video').attr('poster', "/assets/img/stills/" + videos[video_index] + ".jpg"); $('.hero_video .hero_video_src').attr('src', "https://duri86ni1zq5k.cloudfront.net/" + videos[video_index] + ".mp4"); $('.hero_video')[0].load(); $('.hero_video')[0].play(); AdjustVideoDimensions(); $('.hero_video')[0].oncanplay = function () { AdjustVideoDimensions(); } } }); function AdjustVideoDimensions() { if ($('.hero_video').height() < $(window).height()) { $('.hero_video').css('height', '100%'); $('.hero_video').css('width', ''); } if ($('.hero_video').width() < $(window).width()) { $('.hero_video').css('width', '100%'); $('.hero_video').css('height', ''); } } window.onresize = AdjustVideoDimensions; var videos = [ "Canal", "Castle", "Colosseum", "Cruise", "Egypt", "Elephants", "ForbiddenCity", "Forest", "GreatWall", "Hike", "Horses", "Jeep", "NotreDame", "Palace", "Ruins", "Shrine", "Statues", "StPeters", "TajMahal", "Temple", "TourGuide", "Valley", "Village", "Waterfall" ]; window.onscroll = function () { if ($(window).scrollTop() > 0) { $('#header').removeClass('semi-background'); } else { $('#header').addClass('semi-background'); } }