Solved

Javascript streamlining and condensing

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This video teaches users how to migrate an existing Wordpress website to a new domain.

785 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