Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-27-2010, 03:45 PM   PM User | #1
DJCMBear
Senior Coder

 
DJCMBear's Avatar
 
Join Date: Mar 2010
Location: United Kindom
Posts: 1,173
Thanks: 14
Thanked 136 Times in 136 Posts
DJCMBear is on a distinguished road
CUFON Question?

Hi I was just wondering if you could use two different fonts on the same page with CUFON, as you can register a font with the font files but if you register two fonts how how you choose between the fonts.

For example if you do this
Code:
<script src="fonts/cufon.js" type="text/javascript"></script>
<script src="fonts/font1.font.js" type="text/javascript"></script>
<script src="fonts/font2.font.js" type="text/javascript"></script>
But when I use the built-in CUFON replace it only picks the last font registered.
Code:
<script type="text/javascript">
Cufon.replace('#div1'); // Will Replace all text in the div1 with font2
Cufon.replace('#div2'); // Will Replace all text in the div2 with font2
</script>
<div id="div1">Font 1</div>
<div id="div2">Font 2</div>
If anyone knows how to do this please helo, thank you.

EDIT:
I found how you do it you need to use a selector like this.
Code:
<script type="text/javascript">
Cufon.replace('div1',{fontFamily:'font1'});
Cufon.replace('div2',{fontFamily:'font2'});
</script>
__________________
Official BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script here.
Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P

Last edited by DJCMBear; 08-27-2010 at 04:43 PM..
DJCMBear is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:55 AM.


Advertisement
Log in to turn off these ads.