Skip to content

Instantly share code, notes, and snippets.

@AchalJ
Created March 24, 2021 17:21
Show Gist options
  • Select an option

  • Save AchalJ/1d2529616e99ad3f0218a07db8e0108d to your computer and use it in GitHub Desktop.

Select an option

Save AchalJ/1d2529616e99ad3f0218a07db8e0108d to your computer and use it in GitHub Desktop.
PowerPack Content Grid - Equal Align Button
.pp-post-equal-align .pp-post-body {
height: 100%;
}
.pp-post-equal-align:not(.pp-content-alternate) .pp-post-body {
display: flex;
flex-direction: column;
}
.pp-post-equal-align .pp-post-info {
height: 100%;
}
.pp-post-equal-align .pp-content-body {
display: flex;
flex-direction: column;
}
.pp-post-equal-align:not(.pp-content-alternate) .pp-content-body {
height: 100%;
}
;(function($) {
$('.pp-post-equal-align').on('grid.afterInit', function() {
var gridVar = 'ppcg_' + $(this).data('node');
if ( 'undefined' === typeof window[gridVar] ) {
return;
}
var grid = window[gridVar];
$(this).find('.pp-content-post').each(function() {
$(this).find('.pp-content-grid-image').wrapAll('<div class="pp-post-body"></div>');
$(this).find('.pp-content-grid-inner').appendTo( $(this).find('.pp-post-body') );
$(this).find('.pp-content-grid-title').wrapAll('<div class="pp-post-info"></div>');
$(this).find('.pp-content-grid-content').appendTo( $(this).find('.pp-post-info') );
$(this).find('.pp-content-grid-more-link').wrapAll('<div class="pp-post-action"></div>');
$(this).find('.pp-post-info').unwrap();
});
setTimeout(function() {
grid._gridLayoutMatchHeight();
}, 100);
$(window).on('resize', function() {
grid._gridLayoutMatchHeight();
if ($(grid.wrapperClass).data('isotope')) {
$(grid.wrapperClass).isotope('layout');
}
});
});
})(jQuery);
@AchalJ

AchalJ commented Mar 24, 2021

Copy link
Copy Markdown
Author

Instructions

  1. Add the class pp-post-equal-align to the Content Grid module (under Advanced tab > Class field)
  2. Add the JavaScript code to Beaver Builder's Layout JS or Global JS section.
  3. Add the CSS code to Beaver Builder's Layout CSS or Global CSS section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment