Solved

Javascript streamlining and condensing

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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…
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…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

757 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

23 Experts available now in Live!

Get 1:1 Help Now