Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Responsive Design High Performance

You're reading from   Responsive Design High Performance

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781784390839
Length 162 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (11) Chapters Close

Preface 1. The Good, the Bad, and the Ugly of Responsive Web Design FREE CHAPTER 2. Tweaking Your Website for Performance 3. Managing Images 4. Learning Content Management 5. The Fastest HTTP Request is No HTTP Request 6. Testing, Testing, and Testing! 7. Speeding Up Development with Design Concepts, Patterns, and Programs 8. Using Tools for Performance A. Taking the Next Steps Index

One-to-many DOM elements

I briefly touched on this subject in the previous chapter, so let's talk about this a bit more. A great article about showing and hiding elements by Josh Powell can be found at http://www.learningjquery.com/2010/05/now-you-see-me-showhide-performance/.

He compared the speed of showing and hiding elements using different techniques and found that the enabling and disabling of style sheets is the fastest method to show and hide elements on your page. Now, for responsive design, this is very handy, but I feel that hiding elements is being used rather carelessly. When an element is hidden from the viewport of your browser, it still renders when the page is loaded. If you have a lot of elements, they'll all have to render before the page has finished loading. Even worse, if you have images in the section that you are hiding, those requests are still being made to the server.

I propose a better solution. Create a simple rendering function or two rendering functions...

lock icon The rest of the chapter is locked
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 R$50/month. Cancel anytime