Book Image

Mastering jQuery

By : Alex Libby
Book Image

Mastering jQuery

By: Alex Libby

Overview of this book

<p>Mastering jQuery has been written not only to help maximize your skills with core functionality in the library, but also to explore some of the more intriguing ways of using the library to achieve real-world solutions that could feature on any website or online environment.</p> <p>You'll start with a look at some of the more advanced ways to incorporate the library into your pages, followed by working with forms and advanced form validation using regular expressions. Next you'll move on to animating in jQuery, advanced event handling, and using jQuery effects.</p> <p>Finally, you will develop practical examples of using jQuery with external functionality such as node-webkit, before finishing with a session on optimizing your version of the library for maximum efficiency and exploring best practices for using QUnit.</p>
Table of Contents (21 chapters)
Mastering jQuery
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 9. Using the Web Performance APIs

How many times have you had a browser session running with multiple tabs? As a developer, I would expect that to almost be the norm, right?

Now, what if when you switched tabs, content was still playing on the original tab? It's really irritating, right? Sure, we could stop it, but hey, we're busy people with more important things to do…!

Thankfully, this is no longer an issue – in the age of mobile, where conservation of resources is ever more important, we can employ a few tricks to help curb our use. This chapter will introduce you to using the Page Visibility API, and show you how, with some simple changes, you can dramatically reduce the resources used by your site. Over the next few pages, we will cover the following topics:

  • Introducing the Page Visibility and requestAnimationFrame APIs

  • Detecting and adding support, using jQuery

  • Controlling activity using the API

  • Incorporating support into practical uses

Ready to make a start? Good! Let's get going...