Automatic Vimeo aspect ratio

This commit is contained in:
Sam Potts
2017-11-06 22:00:00 +11:00
parent 2497e25b3c
commit 84505da84b
7 changed files with 33 additions and 12 deletions

View File

@ -631,6 +631,13 @@ const utils = {
return fragment.firstChild.innerText;
},
// Get aspect ratio for dimensions
getAspectRatio(width, height) {
const getRatio = (w, h) => (h === 0 ? w : getRatio(h, w % h));
const ratio = getRatio(width, height);
return `${width / ratio}:${height / ratio}`;
},
// Get the transition end event
transitionEnd: (() => {
const element = document.createElement('span');