O'Reilly logo

Head First jQuery by Ronan Cranley, Ryan Benedetti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required