Skip to main content
main-content

Über dieses Buch

Navigate the tricky issues around cross-browser inconsistencies and use jQuery to avoid wasting time fixing these bugs. This book is your step-by-step guide to learning the jQuery library and allows you to concentrate on what really matters to you, mastering the most popular JavaScript library in a web developer’s toolkit.

Throughout this book, you'll discover how expressive yet concise jQuery’s code is and how much quicker and efficiently you can develop with jQuery. Beginning jQuery takes you from the basics of getting you started with jQuery, right through to extending jQuery by writing your own plug-ins. You'll discover best practices you can follow, how you can avoid common mistakes, and learn about the many other assets that jQuery has to offer.

This second edition is completely updated for jQuery version 3.x, including integration with npm, using Yeoman and Jasmine, and guidelines for working with the Dataset API specification.

What You'll Learn

Use jQuery’s powerful tools to dynamically update content on your site, including DOM manipulation.Extend jQuery’s capabilities by writing your own plugins on top of the framework.Animate elements and build your own jQuery slider.Employ best practices and avoid common errors made by beginners.

Who This Book is For

Web developers confident with HTML and CSS and now ready to get to grips with JavaScript and for the developers wanting to enhance their skill set and learn new tools.

Inhaltsverzeichnis

Frontmatter

Chapter 1. JavaScript You Need to Know

jQuery is a framework that’s built on top of JavaScript, not a language in its own right. It is possible to write jQuery with barely any knowledge of JavaScript, but it’s not something we would recommend. If you want to be able to confidently write jQuery plug-ins for your site, or alter plug-ins others have written, you need to be familiar with basic JavaScript. That is why this book starts with JavaScript that you need to know. This chapter covers
Jack Franklin, Russ Ferguson

Chapter 2. The Basics of jQuery

jQuery is a powerful and complex library that was first released in August 2006, although the initial idea came much earlier. Before diving in, there’s time for a very brief history lesson on how the library came to be.
Jack Franklin, Russ Ferguson

Chapter 3. Traversing the DOM

You’ve seen how jQuery works and how to make animated boxes fade in and out. Now it’s time to take a more methodical look at the library and explore everything it can do. This chapter doesn’t cover every method jQuery has to offer because a lot of methods do very similar things. There are also methods that do the exact opposite of each other. For example, in Chapter 2, after looking at how fadeOut() works, you looked only briefly at fadeIn() because it was obvious what it would do, having met fadeOut(). There is a similar situation with a lot of jQuery methods.
Jack Franklin, Russ Ferguson

Chapter 4. DOM Manipulation with jQuery

So now you know a fair amount about jQuery and what it can do. You know how to select elements, how to make sure your code only runs after the DOM is loaded, and plenty more. You’ve also taken a look at animations and done some basic manipulation by changing colors of elements using the css() method. What you might not have realized is that animations are manipulation. Previously, you used fadeIn()/fadeOut() to manipulate the opacity of an element over a period of time. This chapter will focus entirely on manipulation of elements, including:
Jack Franklin, Russ Ferguson

Chapter 5. An Introduction to Events

So now you know a fair amount about jQuery and what it can do. You know how to select elements, how to make sure your code only runs after the DOM is loaded, and plenty more. You’ve also taken a look at animations and done some basic manipulation by changing colors of elements using the css() method. What you might not have realized is that animations are manipulation. Previously, you used fadeIn()/fadeOut() to manipulate the opacity of an element over a period of time. This chapter will focus entirely on manipulation of elements, including:
Jack Franklin, Russ Ferguson

Chapter 6. More Events

So now you know a fair amount about jQuery and what it can do. You know how to select elements, how to make sure your code only runs after the DOM is loaded, and plenty more. You’ve also taken a look at animations and done some basic manipulation by changing colors of elements using the css() method. What you might not have realized is that animations are manipulation. Previously, you used fadeIn()/fadeOut() to manipulate the opacity of an element over a period of time. This chapter will focus entirely on manipulation of elements, including:
Jack Franklin, Russ Ferguson

Chapter 7. Animation

So now you know a fair amount about jQuery and what it can do. You know how to select elements, how to make sure your code only runs after the DOM is loaded, and plenty more. You’ve also taken a look at animations and done some basic manipulation by changing colors of elements using the css() method. What you might not have realized is that animations are manipulation. Previously, you used fadeIn()/fadeOut() to manipulate the opacity of an element over a period of time. This chapter will focus entirely on manipulation of elements, including:
Jack Franklin, Russ Ferguson

Chapter 8. Ajax with jQuery

So now you know a fair amount about jQuery and what it can do. You know how to select elements, how to make sure your code only runs after the DOM is loaded, and plenty more. You’ve also taken a look at animations and done some basic manipulation by changing colors of elements using the css() method. What you might not have realized is that animations are manipulation. Previously, you used fadeIn()/fadeOut() to manipulate the opacity of an element over a period of time. This chapter will focus entirely on manipulation of elements, including:
Jack Franklin, Russ Ferguson

Chapter 9. Writing a jQuery Plug-in

jQuery plug-ins are something that beginners tend to shy away from or are afraid to use. Plug-ins seem to be built up in people’s minds as incredibly complex things to use, but once you learn how they work, you’ll find them actually very straightforward, and you’ll find yourself making multiple plug-ins while working. Plug-ins are not as complicated as you might think, as this chapter will demonstrate.
Jack Franklin, Russ Ferguson

Chapter 10. More jQuery Plug-ins

You ended the last chapter with a pretty awesome accordion plug-in that you built based on the initial accordion code you wrote in Chapter 7. In this chapter, you will take your TVMaze API work from Chapter 8 and turn it into a plug-in. You’ll do this by making a slightly different type of plug-in, one that exists directly on the jQuery object.
Jack Franklin, Russ Ferguson

Chapter 11. A jQuery Image Slider

You’re going to complete the book by building the famed jQuery plug-in: an image slider. This will pull together a lot of parts from the book that you’ve so far only studied in isolation. You’ll use animations to animate your images and events that let the user click through the slider—and end up with a plug-in that’s ready for production. You’ll also encounter new functionality that you haven’t studied yet. For example, you’ll hook up your slider to the keyboard so that the user can press the left or right arrows to navigate. And, you’ll further increase the complexity by allowing the user to pause and play the slider, as well as making it automatically animate every 20 seconds. Although you made a slider in Chapter 7, you’ll start this new one from scratch.
Jack Franklin, Russ Ferguson

Backmatter

Weitere Informationen

Premium Partner

    Bildnachweise