Cufon.replace Even When Text Is Loaded by AJAX or jQuery

Recently I was confronted with a challenge: how to get the text of a heading that was being inserted with jquery+livequery to be replaced with Cufon.

The dilemma: Cufon couldn’t replace the text and it remained the plain, default typeface.

Luckily for me the last post this forum thread reported a way to fix it. Their solution was specific to the task they were trying to accomplish but it was simple to figure out how to re write to solve my problem.

If you are using Cufon already you’ll be familiar with this:

[php]Cufon.replace(‘h2.title’, { fontFamily: ‘greatfont’ });[/php]

If you’re familiar with jQuery you’ll be familiar with this, too:

[php]$("h2.title").livequery(function() {
$(this).text($("#breadcrumbs li:last-child").text());})[/php]

What I had to do was combine each into one function as a separate call from my other Cufon.replace code.
[php]$("h2.title").livequery(function() {
$(this).text($("#breadcrumbs li:last-child").text());
Cufon.replace(‘h2.title’, { fontFamily: ‘greatfont’ });
})[/php]

As added insurance I placed this right before the closing body tag:
[js]<script type="text/javascript">Cufon.now(); </script> [/js]