Created
September 5, 2017 07:31
-
-
Save Rakeshbagri/a0b0aae243594b555675ee95a1832026 to your computer and use it in GitHub Desktop.
how to set fullscreen vimeo video height and width
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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