Skip to content

Instantly share code, notes, and snippets.

@Rakeshbagri
Created September 5, 2017 07:31
Show Gist options
  • Save Rakeshbagri/a0b0aae243594b555675ee95a1832026 to your computer and use it in GitHub Desktop.
Save Rakeshbagri/a0b0aae243594b555675ee95a1832026 to your computer and use it in GitHub Desktop.
how to set fullscreen vimeo video height and width
use this script
<script>
$(document).ready(function(){
function resize(){
// Load Variables - we do this here so they are reset when the screen changes size.
var SW = $(window).width();
var VH = SW * 0.5625;
var SH = $(window).height();
var VW = SH * 1.777;
// Screen size check based on 16:9 ratio
if (SW > VW) {
$("#embed iframe").width(SW).height(VH).css("top", -(VH - SH) /2);
} else {
$("#embed iframe").height(SH).width(VW).css("left", -(VW - SW) /2);
}
// Confirmation
console.log("Resized")
} resize();
$(window).resize(function() {
resize();
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment