PHP 8.1.33
Preview: responsive-embeds.js Size: 1.10 KB
/home/jambtst2015/public_html/qasandra.com/wp-content/themes/twentytwentyone/assets/js/responsive-embeds.js

/**
 * File responsive-embeds.js.
 *
 * Make embeds responsive so they don't overflow their container.
 */

/**
 * Add max-width & max-height to <iframe> elements, depending on their width & height props.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @return {void}
 */
function twentytwentyoneResponsiveEmbeds() {
	var proportion, parentWidth;

	// Loop iframe elements.
	document.querySelectorAll( 'iframe' ).forEach( function( iframe ) {
		// Only continue if the iframe has a width & height defined.
		if ( iframe.width && iframe.height ) {
			// Calculate the proportion/ratio based on the width & height.
			proportion = parseFloat( iframe.width ) / parseFloat( iframe.height );
			// Get the parent element's width.
			parentWidth = parseFloat( window.getComputedStyle( iframe.parentElement, null ).width.replace( 'px', '' ) );
			// Set the max-width & height.
			iframe.style.maxWidth = '100%';
			iframe.style.maxHeight = Math.round( parentWidth / proportion ).toString() + 'px';
		}
	} );
}

// Run on initial load.
twentytwentyoneResponsiveEmbeds();

// Run on resize.
window.onresize = twentytwentyoneResponsiveEmbeds;

Directory Contents

Dirs: 0 × Files: 12

Name Size Perms Modified Actions
123 B lrw-r--r-- 2024-11-22 17:53:25
Edit Download
1.01 KB lrw-r--r-- 2024-11-22 17:53:25
Edit Download
2.47 KB lrw-r--r-- 2024-11-22 17:53:25
Edit Download
1.00 KB lrw-r--r-- 2024-11-22 17:53:25
Edit Download
2.19 KB lrw-r--r-- 2024-11-22 17:53:25
Edit Download
1.21 KB lrw-r--r-- 2024-11-22 17:53:25
Edit Download
921 B lrw-r--r-- 2024-11-22 17:53:25
Edit Download
1.52 KB lrw-r--r-- 2024-11-22 17:53:25
Edit Download
1.03 KB lrw-r--r-- 2024-11-22 17:53:25
Edit Download
5.57 KB lrw-r--r-- 2024-11-22 17:53:25
Edit Download
1.10 KB lrw-r--r-- 2024-11-22 17:53:25
Edit Download
797 B lrw-r--r-- 2024-11-22 17:53:25
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).