Skip to content

Instantly share code, notes, and snippets.

@uzielweb
Created September 18, 2021 07:57
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 uzielweb/9ed81db98d11b287a29a9db5025b153c to your computer and use it in GitHub Desktop.
Save uzielweb/9ed81db98d11b287a29a9db5025b153c to your computer and use it in GitHub Desktop.
Change span to col-md- classes in Helix Ultimate
// add class row to sp-column when children has any part of class with span in the classname
jQuery(document).ready(function ($) {
$('.sp-column').each(function () {
// get the children class names with span in the classname
var childrenClasses = $(this).children().map(function () { return this.className; }).get().join(' ');
// if children has any part of class with span in the classname
if (childrenClasses.indexOf('span') > -1) { $(this).addClass('row'); }
// change parte of classname with span to col-md-
$(this).children().each(function () {
var className = $(this).attr('class');
className = className.replace(/span/g, 'col-md-');
$(this).attr('class', className);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment