Created
April 12, 2017 14:18
-
-
Save joeworkman/c8c505f83f706c447ca2c95263f3563d to your computer and use it in GitHub Desktop.
Hotfix for Impact Video not scaling
This file contains hidden or 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
$(window).load(function(){ | |
function resizeToCover(video,container,natural_width,natural_height) { | |
// set the video viewport to slide size which is determined by parent stack JS | |
var scale_h = container.width() / natural_width; | |
var scale_v = container.height() / natural_height; | |
var scale = scale_h > scale_v ? scale_h : scale_v; | |
// don't allow scaled width < minimum video width | |
if (scale * natural_width < min_width) {scale = min_width / natural_width;}; | |
video.css('width',scale * natural_width); | |
video.css('height',scale * natural_height); | |
video.css('margin-left', -1 * ((video.width() - container.width()) / 2) ); | |
video.css('margin-top', -1 * ((video.height() - container.height()) / 2) ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment