← All changes
|
modules/theme-tools/responsive-videos/responsive-videos.js
+2
-1
12.5.2
→
16.3-beta
View file →
| @@ -26,9 +26,8 @@ | ||
| 26 | 26 | video.style.display = 'block'; |
| 27 | 27 | video.style.margin = videoMargin; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - const videoWidth = video.getAttribute( 'data-width' ); | |
| 31 | 30 | const videoHeight = video.getAttribute( 'data-height' ); |
| 32 | 31 | const videoRatio = video.getAttribute( 'data-ratio' ); |
| 33 | 32 | const containerWidth = video.parentElement.clientWidth; |
| 34 | 33 | |
| @@ -39,8 +38,10 @@ | ||
| 39 | 38 | video.style.width = '100%'; |
| 40 | 39 | video.style.height = videoHeight + 'px'; |
| 41 | 40 | return; |
| 42 | 41 | } |
| 42 | + | |
| 43 | + const videoWidth = video.getAttribute( 'data-width' ); | |
| 43 | 44 | |
| 44 | 45 | if ( parseInt( videoWidth, 10 ) > containerWidth ) { |
| 45 | 46 | video.style.width = containerWidth + 'px'; |
| 46 | 47 | video.style.height = containerWidth * parseFloat( videoRatio ) + 'px'; |