aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plugins/vimeo.js
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2017-11-06 19:38:31 +1100
committerSam Potts <me@sampotts.me>2017-11-06 19:38:31 +1100
commit006871074032e5b24408fb654eb2856585c491e1 (patch)
tree7fdfd71a6ff6bc1abef9d343e87e9f9f08a34346 /src/js/plugins/vimeo.js
parent5fe477340b7c446dcbf711daa06d81c725c45b34 (diff)
downloadplyr-006871074032e5b24408fb654eb2856585c491e1.tar.lz
plyr-006871074032e5b24408fb654eb2856585c491e1.tar.xz
plyr-006871074032e5b24408fb654eb2856585c491e1.zip
Started on documentation and aspect ratio option
Diffstat (limited to 'src/js/plugins/vimeo.js')
-rw-r--r--src/js/plugins/vimeo.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js
index 0b815fa5..0f6aa4db 100644
--- a/src/js/plugins/vimeo.js
+++ b/src/js/plugins/vimeo.js
@@ -15,6 +15,13 @@ const vimeo = {
// Add embed class for responsive
utils.toggleClass(this.elements.wrapper, this.config.classNames.embed, true);
+ // Set aspect ratio
+ const ratio = this.config.ratio.split(':');
+ const padding = 100 / ratio[0] * ratio[1];
+ const offset = (100 - padding) / 2;
+ this.elements.wrapper.style.paddingBottom = `${padding}%`;
+ this.media.style.transform = `translateY(-${offset}%)`;
+
// Set ID
this.media.setAttribute('id', utils.generateId(this.type));