Solved

Javascript streamlining and condensing

Posted on 2013-05-20
1
250 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

820 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