aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plugins/youtube.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/plugins/youtube.js')
-rw-r--r--src/js/plugins/youtube.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js
index 2c8557dc..ca0f2991 100644
--- a/src/js/plugins/youtube.js
+++ b/src/js/plugins/youtube.js
@@ -18,8 +18,7 @@ const youtube = {
utils.toggleClass(this.elements.wrapper, this.config.classNames.embed, true);
// Set aspect ratio
- const ratio = this.config.ratio.split(':');
- this.elements.wrapper.style.paddingBottom = `${100 / ratio[0] * ratio[1]}%`;
+ youtube.setAspectRatio.call(this);
// Set ID
this.media.setAttribute('id', utils.generateId(this.type));
@@ -48,6 +47,12 @@ const youtube = {
}
},
+ // Set aspect ratio
+ setAspectRatio() {
+ const ratio = this.config.ratio.split(':');
+ this.elements.wrapper.style.paddingBottom = `${100 / ratio[0] * ratio[1]}%`;
+ },
+
// API ready
ready(videoId) {
const player = this;