Full size Vimeo background cover
How do I make an full size vimeo background cover?
This a full viewport size video (background) that acts like background-size: cover; when resized. What is a full size vimeo background cover? How do you make a full size vimeo background cover? This script and codes were developed by Henri Peetsmann on 09 December 2022, Friday.
Full size Vimeo background cover - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Full size Vimeo background cover</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="videobg"> <div class="videobg-width"> <div class="videobg-aspect"> <div class="videobg-make-height"> <div class="videobg-hide-controls"> <iframe src="https://player.vimeo.com/video/8970192?autoplay=1&loop=1&title=0&byline=0&portrait=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> </div> </div> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Full size Vimeo background cover - Script Codes CSS Codes
/* Quick reset */
* { margin: 0; padding: 0; box-sizing: border-box;
}
/* Make elements as high as viewport */
html { height: 100%;
}
body { position: relative; height: 100%;
}
/* Video background */
.videobg { position: relative; width: 100%; /* Set video container element width here */ height: 100%; /* Set video container element height here */ overflow: hidden; background: #111; /* bg color, if video is not high enough */
}
/* horizontally center the video */
.videobg-width { position: absolute; width: 100%; /* Change width value to cover more area*/ height: 100%; left: -9999px; right: -9999px; margin: auto;
}
/* set video aspect ratio and vertically center */
.videobg-aspect { position: absolute; width: 100%; height: 0; top: -9999px; bottom: -9999px; margin: auto; padding-bottom: 56.25%; /* 16:9 ratio */ overflow: hidden;
}
.videobg-make-height { position: absolute; top: 0; right: 0; bottom: 0; left: 0;
}
.videobg-hide-controls { box-sizing: content-box; position: relative; height: 100%; width: 100%; /* Vimeo timeline and play button are ~55px high */ padding: 55px 97.7777px; /* 16:9 ratio */ top: -55px; left: -97.7777px; /* 16:9 ratio */
}
.videobg iframe { position: absolute; width: 100%; height: 100%; top: 0; left: 0; border: 0 none;
}
Full size Vimeo background cover - Script Codes JS Codes
var timeoutId;
var $videoBgAspect = $(".videobg-aspect");
var $videoBgWidth = $(".videobg-width");
var videoAspect = $videoBgAspect.outerHeight() / $videoBgAspect.outerWidth();
function videobgEnlarge() { console.log('resize'); windowAspect = ($(window).height() / $(window).width()); if (windowAspect > videoAspect) { $videoBgWidth.width((windowAspect / videoAspect) * 100 + '%'); } else { $videoBgWidth.width(100 + "%") }
}
$(window).resize(function() { clearTimeout(timeoutId); timeoutId = setTimeout(videobgEnlarge, 100);
});
$(function() { videobgEnlarge();
});
Developer | Henri Peetsmann |
Username | henripeetsmann |
Uploaded | December 09, 2022 |
Rating | 3 |
Size | 2,491 Kb |
Views | 30,360 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Responsive MacBook retina mockup | 3,228 Kb |
Responsive Moto G mockup | 3,415 Kb |
A Pen by Henri Peetsmann | 3,559 Kb |
Search box | 2,434 Kb |
Responsive SVG cross-browser | 2,078 Kb |
Sprite animation experiment | 1,638 Kb |
Dynamic ring loader | 3,331 Kb |
Sponsor logos | 3,285 Kb |
Price ribbon | 2,089 Kb |
EM Units Experiment | 1,921 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSS 3D Radio buttons | Andreasnylin | 1,650 Kb |
Click handler test | Snapson | 2,329 Kb |
Filtering with shuffle.js | Deyand | 2,712 Kb |
About Us | Francescaedits | 1,902 Kb |
CSS eye follow | Pedrocampos | 2,592 Kb |
Horizontal scroll fixed element | HerrSerker | 0 Kb |
Sexy Social Buttons | Ipiyale | 2,226 Kb |
Scifi-style Radio-based Tab | Aaronchuo | 4,427 Kb |
A Pen by Kenny Mark | Kennymark | 5,574 Kb |
CMP5-Opdracht15 | SannevanGastel | 2,733 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!