Note that there are some explanatory texts on larger screens.

plurals
  1. POIE reports incorrect .height() on content added after pageload
    primarykey
    data
    text
    <p>I'm implementing an infinite-scroll, which means I'm appending chunks of content into the DOM (via jquery and javascript).</p> <p>To make this feel smooth for the user, we need to do some manual scrolling to keep the content window "in the same place", especially as we prepend text in front of what the user is seeing. To accomplish this (prepend a chunk, then scroll the content down by the exact amount we prepended) we need to be able to determine the HEIGHT of the content we just prepended. This is where Firefox and IE differ. Firefox handles this correctly, and scrolls to the correct place in my content, but IE is reporting about 600px as the height when the true value is around 2400px. </p> <pre><code>var h1 = $(document).height(); //take the height before appending $('#textChunks').prepend(newContent); // prepend stuff on top var h2 = $(document).height();//take the height again... alert(h2-h1); </code></pre> <p>The alerted value is consistently wrong in IE (off by a factor of 3), and it's consistent no matter how I take the measurement (I could instead measure the height of the 'newContent' after it's in the DOM and IE still reports it wrong, but consistently). Even other 'built in' javascript functions such as .scrollIntoView() seem to be off by exactly this amount in IE. </p> <p>As a sanity check, I can create a stand-alone html file on my desktop with a sample of my content, and in this situation it works. So the problem seems to be only with content added after the pageload. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload