Solved

Javascript streamlining and condensing

Posted on 2013-05-20
1
248 Views
Last Modified: 2013-05-21
Is there a way to streamline and/or condense the following Javascript?

<script type="text/javascript">  
    Cufon.replace('.fugu-lrg', { fontFamily: 'Fugu' });
    Cufon.replace('.fugu-xl', { fontFamily: 'Fugu' });
    Cufon.replace('.fugu-med', { fontFamily: 'Fugu' });
    Cufon.replace('.fugu-lrg-white', { fontFamily: 'Fugu' });
	Cufon.replace('.gotham-lrg', { fontFamily: 'Gotham Book' });
	Cufon.replace('.gotham-med-lrg', { fontFamily: 'Gotham Book' });
	Cufon.replace('.gotham-med', { fontFamily: 'Gotham Book' });
	Cufon.replace('.index-title', { fontFamily: 'Gotham Book' });
	Cufon.replace('.gotham-grey', { fontFamily: 'Gotham Book' });
	Cufon.replace('.sales-title', { fontFamily: 'Gotham Book' });
	Cufon.replace('.sales-content', { fontFamily: 'Gotham Book' });
	Cufon.replace('.sale-action-left', { fontFamily: 'Gotham Bold' });
	Cufon.replace('.sale-action-right', { fontFamily: 'Gotham Book' });			
</script>

Open in new window

0
Comment
Question by:rgranlund
1 Comment
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 39183944
Hi,
if you use jQuery / load jQuery before then you should be able to use:
<script type="text/javascript">  
    Cufon.replace('.fugu-lrg,.fugu-xl,.fugu-med,.fugu-lrg-white', { fontFamily: 'Fugu' });
	Cufon.replace('.gotham-lrg,.gotham-med-lrg,.gotham-med,.index-title,.gotham-grey,.sales-title,.sales-content,.sale-action-right', { fontFamily: 'Gotham Book' });
	Cufon.replace('.sale-action-left', { fontFamily: 'Gotham Bold' });
</script>

Open in new window

HTH
Rainer
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now