Snippets: Trigger Stretched Rows Inside WPBakery Page Builder Tabs

By default if you add a stretched row in the WPBakery Page Builder (formerly known as Visual Composer) it won't render properly because these rows need to be visible on site load to display properly as they aren't really intended to be added inside a hidden area such as tabs. However, with the code above added to your child theme you can re-trigger the stretched row javascript whenever a tab loads or is clicked so you can have stretched rows inside tabs.

add_action( 'wp_footer', function() { ?>

	<script>
		( function( $ ) {
			function onShow() {
				vc_rowBehaviour();
			}
			$( '.vc_tta-tabs' ).on( 'show.vc.tab', 'onShow' );
			$( document ).on( 'click.vc.tabs.data-api', '[data-vc-tabs]', onShow );
			$( document ).on( 'show.vc.accordion', onShow );
		} ) ( jQuery );
	</script>

<?php } );
All PHP snippets should be added via a child theme's functions.php file.