Chapter 7. Custom Functions for Custom Effects: What Have You Done for Me Lately?

image with no caption

When you combine jQuery’s custom effects with JavaScript functions you can make your code—and your web app—more efficient, more effective, and more powerful. In this chapter, you’ll dig deeper into improving your jQuery effects by handling browser events, working with timed functions, and improving the organization and reusability of your custom JavaScript functions.

A storm is brewing

The Monster Mashup web app you built in Chapter 5 was a big hit with kids and their parents. But it sounds like there might be a bug that’s making the lightning go haywire. DoodleStuff’s quality assurance manager contacts you with some issues and a feature request for making Monster Mashup better.

image with no caption
image with no caption

Brain Power

Try reproducing the issue. Then think about what’s going wrong with the lightning functions. Why do they all crash together when someone switches from one tab to another?

We’ve created a monster...function

The lightning function we created in Chapter 5 has turned out to be a bit of a monster. It runs and runs, even if the user navigates away from the page. When the user returns to the tab, the timer has to catch up, and it ...

Get Head First jQuery now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.