82858

Does an HTML element absolutely positioned outside of the viewport area affect the performance of re

Question:

For example, if I have a <div> with style:

position: absolute; width: 100px; height: 100px; left: -10000px; top: -10000px;

When a repaint of the viewport happen, there is some time loss due to the div's presence in DOM?

NOTE: the <div> has visibility: visible and display: block

Answer1:

Simple answer - yes.

Even though you can't see it, it still has to be rendered into the DOM as you say.

People do this a lot then do some fancy animation to bring it into view. The thing to ask is is there a difference between rendering the whole DOM in one hit or would you save time by rendering each bit, when requested with AJAX ?

It depends on the complexitity of the content in your 'hidden' section(s)...

Edit: Try using Fiddler : <a href="http://www.telerik.com/fiddler" rel="nofollow">http://www.telerik.com/fiddler</a> : this will allow you to see what is taking time to load on your pages...

Recommend

  • Parent Child SQL Recursion
  • Mongoid same embedded documents types for different fields
  • how to insert a new column in a dataset with values if it satisfies a statement
  • How to make Javascript generated checkboxes persist?
  • SIP Makefile fail (gnuwin and mingw)
  • How to add learning rate to summaries?
  • How to add closing tag for canvas in three js rendered Canvas?
  • Get the pasted content on document on paste event
  • Responsive left sidebar open close
  • Prevent page break in text block with iText, XMLWorker
  • C# - Most efficient way to iterate through multiple arrays/list
  • New Firebase failed: First argument must be a valid firebase URL and the path can't contain “.”
  • C++ friend class std::vector
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • SyntaxError: (irb):26: both block arg and actual block given
  • How to make R's read_csv2() recognise the text characters properly
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • Not able to aggregate on nested fields in elasticsearch
  • Unable to install Git-core+svn by MacPorts
  • Django simple Captcha “No module named fields” error
  • Could not find rake using whenever rails
  • Initializer list vs. initialization method
  • CSS Linear-gradient formatting issue accross different browsers
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Validaiting emails with Net.Mail MailAddress
  • Which linear programming package should I use for high numbers of constraints and “warm starts” [clo
  • Javascript + PHP Encryption with pidCrypt
  • Jquery - Jquery Wysiwyg return html as a string
  • Arrays break string types in Julia
  • SetUp method failed while running tests from teamcity
  • WPF Applying a trigger on binding failure
  • using HTMLImports.whenReady not working in chrome
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Java static initializers and reflection
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • How can I remove ASP.NET Designer.cs files?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]