Home › Forums › WoodMart support forum › Youtube-Videos too small
Youtube-Videos too small
- This topic has 9 replies, 3 voices, and was last updated 2 years, 9 months ago by Bogdan Donovan.
-
AuthorPosts
-
March 28, 2022 at 8:15 am #364503
lensaidphotoParticipantHi,
Youtube-Videos are to small on the frontend. At the backend editor its okay, but not on the live site.
How can we fix this?
Thank you!
Attachments:
You must be logged in to view attached files.March 28, 2022 at 8:29 am #364514
Artem TemosKeymasterHi,
Could you please send us a link to your website where we can see this issue?
Kind Regards
March 28, 2022 at 8:30 am #364515
lensaidphotoParticipantOf course. At the bottom of this article: https://www.lens-aid.de/blog/fotografie-recht-was-darf-ich-alles-fotografieren/
March 28, 2022 at 8:32 am #364516
Artem TemosKeymasterPlease, send us your admin access also.
Thank you in advance.
March 28, 2022 at 10:12 am #364549
lensaidphotoParticipantHere we go…
March 29, 2022 at 6:14 am #364773
Bogdan DonovanKeymasterHello,
Could you please check how it works with some default WordPress themes like TwentyTwenty or WooCommerce Storefront to understand is it our theme issue or not?
Regards
March 29, 2022 at 8:29 am #364815
lensaidphotoParticipantHello,
I just checked in our staging environment with several other themes (TwentyTwenty, Colormag, TwentySixteen and Shoptimizer) – all good with Youtube. So it has something to do with Woodmart.
By the way: I just paste the Youtube video link into the editor, so its automatically embed.
March 29, 2022 at 1:22 pm #364925
Bogdan DonovanKeymasterTry to add the following code snippet to the Custom JS on the document ready area in Theme Settings to fix this issue.
function customVideoResize() { document.querySelectorAll( 'iframe, object, video' ).forEach( function( video ) { var ratio, iTargetWidth, container = video.parentNode; // Skip videos we want to ignore. if ( video.classList.contains( 'intrinsic-ignore' ) || video.parentNode.classList.contains( 'intrinsic-ignore' ) ) { return true; } if ( ! video.dataset.origwidth ) { // Get the video element proportions. video.setAttribute( 'data-origwidth', video.width ); video.setAttribute( 'data-origheight', video.height ); } iTargetWidth = container.offsetWidth; // Get ratio from proportions. ratio = iTargetWidth / video.dataset.origwidth; // Scale based on ratio, thus retaining proportions. video.style.width = iTargetWidth + 'px'; video.style.height = ( video.dataset.origheight * ratio ) + 'px'; } ); } customVideoResize() window.addEventListener( 'resize', function() { customVideoResize() }); window.addEventListener( 'load', function() { customVideoResize() });
Kind Regards
March 29, 2022 at 1:25 pm #364928
lensaidphotoParticipantThank you very much! It works great! 🙂
March 30, 2022 at 6:04 am #365077
Bogdan DonovanKeymasterYou are welcome!
-
AuthorPosts
- You must be logged in to create new topics. Login / Register