Cufon - jQuery, Replace font color on click

tsiger picture tsiger · Dec 23, 2009 · Viewed 7.5k times · Source

I am using cufon for some font replacement and jQuery to build a custom accordion.

the code for my accordion is something like this:

 $(".acc-title").click(function () {
   //show something, hide something etc.
 });

Is it possible during the click event to change the color of the replaced (with cufon) font?

something like:

$(".acc-title").click(function () {
       //some something, hide something etc.
       Cufon.replace('how do i select ONLY the title of this', { color: '#fff' });
});

Answer

Kenneth picture Kenneth · Aug 26, 2010

You must use Cufon.refresh(); after you change the color by CSS. Like this:

$("#tab1").click(function() {
   $("#tab2").removeClass("selected");
   $("#tab1").addClass("selected");
   Cufon.refresh();
}