Home Forums WoodMart support forum Youtube-Videos too small

Youtube-Videos too small

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #364503

    lensaidphoto
    Participant

    Hi,

    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.
    #364514

    Artem Temos
    Keymaster

    Hi,

    Could you please send us a link to your website where we can see this issue?

    Kind Regards

    #364515

    lensaidphoto
    Participant
    #364516

    Artem Temos
    Keymaster

    Please, send us your admin access also.

    Thank you in advance.

    #364549

    lensaidphoto
    Participant

    Here we go…

    #364773

    Bogdan Donovan
    Keymaster

    Hello,

    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

    #364815

    lensaidphoto
    Participant

    Hello,

    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.

    #364925

    Bogdan Donovan
    Keymaster

    Try 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

    #364928

    lensaidphoto
    Participant

    Thank you very much! It works great! 🙂

    #365077

    Bogdan Donovan
    Keymaster

    You are welcome!

Viewing 10 posts - 1 through 10 (of 10 total)