Add class to change font-family
I'm trying to update the font-family assigned to some classes. Unfortunately, the class doesn't seem to be applying and I don't know what I could be doing wrong.
My script:
- $('div[class^="ls-wrapper"]').promise().done(function() {
- $('div[class^="lslide_wrap"]').each(function() {
- var clcheck = $(this).attr('class').substr($(this).attr('class').indexOf("in_") + 3);
- var acheck = $(this).children('a').attr('class').substr($(this).children('a').attr('class').lastIndexOf("in_") + 3);
- if (clcheck != acheck) {
- $(this).find('a span span').each(function(c) {
- var charclassinit = $(this).attr('class');
- var charclend = $(this).attr('class').substr($(this).attr('class').indexOf("ls-") +0);
- var charnum = $(this).attr('class').substr($(this).attr('class').indexOf("ls-w") + 4).substring(0,1);
- var charclbeg = charclassinit.replace(charclend, '');
- var wrapclass = $(this).closest('[class^="lslide_wrap"]').attr('class');
- var wrapnum = $(this).closest('[class^="lslide_wrap"]').attr('class').substr($(this).closest('[class^="lslide_wrap"]').attr('class').indexOf("ap_") + 3).substring(0,1);
- var cltar = '.' + wrapclass + ' .'+charclend;
- charsel = wrapnum + 'ls-w' + charnum;
- $(cltar).addClass(charsel);
- });
- }
- });
- });
Sample html:
- <div class="lside_wrap_1_stacks_in_259_page4">
- < a href=... class="lslide_stacks_in_259_page4">
- <span class="ls-wrapper_stacks_in_260_page4" ...>
- <span class="char1 ls-w2_stacks_in_260_page4"...></span>
- <span class="char1 ls-w1_stacks_in_260_page4"...></span>
- </span>
- ... more similar spans
- </a>
- </div>
The classes assigned to the example:
.1ls-w1 {
font-family: Courgette !important;
}
.1ls-w2 {
font-family: Allura !important;
}
The classes are being added, but I don't see the font-family being applied, the default theme font (LiberationSerifRegular) is showing up.
The word Courgette should show a script type of font.
I'd appreciate the help in figuring this out.
Thanks