Change font for £ after page loaded
I have a situation where the font in a H3 element is being replace by Cufon with a font that does not have a pound 开发者_如何学运维L (£).
As a quick fix I want to replace any £ in H3 element with a different font AFTER cufon has done it's thing.
I think jQuery can do this. I guess it will have to replace the £ with a span tag which calls a different font?
Previous answer changes font for whole element, this does just the one character.
$('h3').each(function() {$(this).html($(this).html().replace('£','<span font="your font">£</span>'));});
This checks all h3
elements with the "oldFont" class for occurrences of the "£" character and wraps them all in a span
with a class of "newFont":
$("h3.oldFont").each(function() {
$(this).html($(this).html().replace(/£/g, "<span class='newFont'>£</span>"));
});
$(document).ready(function(){
$("h3:contains('£')").css('font-face','Arial');
});
精彩评论