Problems calling Cufon.Replace from within a function
Posted
by Kenny Bones
on Stack Overflow
See other posts from Stack Overflow
or by Kenny Bones
Published on 2010-04-18T20:51:53Z
Indexed on
2010/04/18
21:23 UTC
Read the original article
Hit count: 556
Hi, I'm doing a content loader and the content that gets loaded needs some Cufon action. And that doesn't work right now since I only apply Cufon when the initial page loads. And not the newly loaded content.
Now, shouldn't this be working?
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
Cufon.replace('h1, h2, h3, h4, .menuwrapper', { fontFamily: 'advent'});}
Or am I not getting something? I've also tried calling Cufon.Replace right after the procedure that calls the loadContent function, but that only applies the Cufon the next time I click a link.
$('.dynload').live('click', function(){
var toLoad = $(this).attr('href')+' #content';
$('#content').fadeOut('fast',loadContent);
$('#ajaxloader').fadeIn('normal');
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length);
Cufon.replace('h1, h2, h3, h4, .menuwrapper', { fontFamily: 'advent'});
How can I make sure Cufon is applied as soon as possible after loading new content? I was thinking about calling Cufon.replace the moment before the new content is faded in. But this doesn't seem to be working.
© Stack Overflow or respective owner