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

JavaScript basics

In this section, we're going to cover a few basics of JavaScript that will make things go more smoothly. We're going to look at a little bit of code and step through how it works. Don't be intimidated; this will be quick and painless, and then we'll be ready to get on with actually doing something with jQuery.

Progressive enhancement and graceful degradation

There are a few different schools of thought when it comes to enhancing your HTML pages with JavaScript. Let's talk about some of the things we should consider before we dive into the cool stuff.

Progressive enhancement and graceful degradation are essentially two sides of the same coin. They both mean that our page with its impressive JavaScript animations and special effects will still work for users who have less capable browsers or devices. Graceful degradation means that we create our special effect and then make sure it fails gracefully if JavaScript is not enabled. If we take the progressive enhancement approach, we'll first build out a bare bones version of our page that works for everyone, and then enhance it by adding our JavaScript special effects. I tend to favor the progressive enhancement approach.

Why should we care about users who don't have JavaScript enabled? Well, some of the Web's biggest users and search engines have either no JavaScript capabilities or very limited JavaScript capabilities. When search engines are crawling and indexing your pages, they will not have access to all of the content and features that are being added to your pages by JavaScript. This is often referred to as dynamic content, and it can't be reliably indexed or found by search engines if it can't be reached with JavaScript disabled.

We're also in an era where we can no longer count on users who access the web pages we build with a conventional desktop or laptop computer. We're quick to think of smartphones and tablets as the next candidates, and while they are very popular, they still account for a tiny fraction of Internet access. People are accessing the Web from gaming consoles, feature phones, e-book readers, internet-enabled televisions, a huge variety of mobile devices, and dozens of other ways. Not all of these devices are capable of executing JavaScript, and some of them don't even have color screens! Your number one priority should be making sure that your content is available to anyone who asks for it, no matter what device they happen to be using.

Gotta keep 'em separated

To accomplish this task of making our content available to as wide an audience as possible, we have to think of our web pages in three separate and distinct layers: content, presentation, and behavior.

Content

Content is the meat of our web page. It's the text or audio or video content that we're most interested in presenting on our page; so this is where we start.

Mark up your content with clean and simple HTML code. Use HTML elements the way they were intended to be used. Mark up headings with heading tags, paragraphs with paragraph tags, lists with list tags, and save tables for tabular data.

Browsers have built-in styles for these basic HTML tags—headings will be of a larger type and will probably look bold. Lists will have bullets or numbers. It might not look very fancy, but it's readable and accessible to anyone.

Presentation

The presentation layer is where we start to get fancy. This is where we introduce CSS and start applying our own styles to the content we've created. As we style our page, we might find that we have to go back into our HTML code and add some new containers and markup to make things such as multicolumn layouts possible, but we should still strive to keep our markup as simple and as straightforward as we can.

Behavior

Once our page has all of our content properly marked up and is styled to look the way we like, we can think about adding in some interactive behavior. This is where JavaScript and jQuery come in. This layer includes animations, special effects, AJAX, and so on.

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