Sep 8, 2017 - jQuery, WordPress    Comments Off on JS for iconifying menu tiems

JS for iconifying menu tiems


$('li.menu-item.icon').each(function(){
var cont = $(this);
var list = $(this).attr('class').split(/\s+/);
var link = $(this).find('a');
console.log(list);
$.each(list, function(index, item) {
console.log(item);
if (item.match(/fa-(.*)/)) {
//do something
link.addClass('fa');
link.find('span').addClass('screen-reader-text');
link.addClass(item);
cont.removeClass(item);
}
});
});

Comments are closed.