Skip to content

Instantly share code, notes, and snippets.

@michaelbourne
Created May 2, 2018 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelbourne/64b216fa64852b15f8d458798fbba058 to your computer and use it in GitHub Desktop.
Save michaelbourne/64b216fa64852b15f8d458798fbba058 to your computer and use it in GitHub Desktop.
X Theme / Pro Theme javascript based grid
(function($){
$(window).on('ready load resize', function(){
var max = 0,
mobile = $(window).width(),
numChildren = $('.jsmethodgrid').first().children().size();
$(".jsmethodgrid .x-column").css('min-height','inherit');
if ( mobile > 767 ){
$('.jsmethodgrid .x-column').css({ 'width' : 100/numChildren + '%', 'margin': 0 });
$(".jsmethodgrid .x-column").each(function(index, el) {
if( $(this).outerHeight() > max ){
max = $(this).outerHeight();
}
});
$(".jsmethodgrid .x-column").css('min-height', max);
} else {
$('.jsmethodgrid .x-column').css('width','100%');
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment