Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
jQuery for Designers Beginner's Guide Second Edition

You're reading from   jQuery for Designers Beginner's Guide Second Edition Design interactive websites to improve user experience by using the popular JavaScript library

Arrow left icon
Product type Paperback
Published in Jul 2014
Publisher
ISBN-13 9781783284535
Length 398 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Natalie Maclees Natalie Maclees
Author Profile Icon Natalie Maclees
Natalie Maclees
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Designer, Meet jQuery FREE CHAPTER 2. Enhancing Links 3. Making a Better FAQ Page 4. Building an Interactive Navigation Menu 5. Showing Content in Lightboxes 6. Creating Slideshows and Sliders 7. Working with Responsive Designs 8. Getting the Most from Images 9. Improving Typography 10. Displaying Data Beautifully 11. Reacting to Scrolling 12. Improving Forms A. Pop Quiz Answers Index

Another option for using jQuery

There is nothing wrong with downloading and using your own copy of jQuery, but you do have another option available that can help to improve the performance of your websites. That's to use a CDN-hosted copy of jQuery.

In case you don't know, a CDN is a Content Delivery Network. The premise behind a CDN is that files download faster from servers that are physically closer to a site visitor's location. So, for example, if you're in Los Angeles, California, a copy of jQuery that's on a server in Phoenix, Arizona will download faster than a copy that's on a server in New York City. To help this along, a CDN has a copy of the same file on lots of different servers all around the world. Each time a site visitor requests a file, the CDN smartly routes their request to the closest available server, helping to improve response times and overall site performance.

It won't make much of a difference for the relatively simple examples and pages that we'll build in this book, but for a public-facing website, using a CDN-hosted copy of jQuery can make a noticeable difference. There are a few options out there, but the most popular by far is Google's Ajax API CDN. You can get the information on the latest version available and the correct URL at http://code.google.com/apis/libraries/devguide.html#jquery.

Note

There are several CDN-hosted copies of jQuery available. You can find out about these on jQuery's Download page (http://jquery.com/download/). Just scroll down to the section titled Using jQuery with a CDN to find all your current options.

If you'd like to use the Google CDN-hosted version of jQuery in your files, it's as simple as adding the following line of code to your HTML file, instead of the line we used in the previous section to include jQuery:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

No downloading the file, no saving your own copy; you can just point your <script> tag directly at the copy of jQuery stored on Google's servers. Google will then take care of sending jQuery to your site visitors from the closest available server. Not only that, but as Google's CDN is so popular, there's a good chance that your site visitor has already visited another site that's also using a Google CDN-hosted copy of jQuery and that they'll have jQuery cached in their browser. This means that your site visitor won't have to download jQuery at all—it's already saved in their browser and available to be used. How's that for improving performance?

You have been reading a chapter from
jQuery for Designers Beginner's Guide Second Edition
Published in: Jul 2014
Publisher:
ISBN-13: 9781783284535
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image