Cufon active & cufon loading not working

235 views
Skip to first unread message

Andrew

unread,
Feb 12, 2011, 4:00:50 AM2/12/11
to cufón
Hi Simmo,

I'm Andrew from Indonesia and I got a little issue with cufon and I
hope you can help me. My client expected to hide the fallback font
until the cufon is finished loading but when the browser have JS
disabled they want to see the fallback font instead of see the blank
spot.
So below are my approach

Here are the css code:

h1 { font-size: 47px; line-height: 40px; font-weight: normal; color:
#1d76bb; }
.cufon-loading h1 { color: green !important; }
.cufon-ready h1 { font-size: 49px; color: red !important; }

Here's the JS code:

Cufon.replace('#content h1', { fontFamily: 'HelveticaNeue' });
Cufon.replace('.balloon-content p', { fontFamily: 'Helvetica Neue' });
Cufon.now();

From the code above I'm expecting when cufon is loading the text will
have green color then when it's ready it will have red color. but
things that happened is I didn't see the text goes green as if the
cufon-loading class didn't apply to the html tag, could you advise
how to fix it?

Looking forward to your answer and really appreciate it.

ps: Sorry I can't give you link to the live site, also the css code
above is for testing purpose only and I will change the style after
the issue resolved

Terima kasih :)

Andrew Manullang

Simo Kinnunen

unread,
Feb 12, 2011, 4:07:46 AM2/12/11
to cu...@googlegroups.com
Hi,

Cufón doesn't add any of the CSS classes until .replace() has been called at least once. This makes me think that you are either A) calling Cufon.replace() at the bottom of your page, or B) wrapping the replace calls in $(document).ready() or something of sorts, which is wrong.

To get the expected behavior, you need to have your .replace() calls in <head> (the calls can still be in an external JS file, of course, as long as the file is loaded in <head>), and not wrapped in any any kind of document.ready thing.

Simo

> --
> You received this message because you are subscribed to the Google Groups "cufón" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cufon+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cufon?hl=en.
>

Reply all
Reply to author
Forward
0 new messages