Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8618361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:05:21+00:00 2026-06-12T06:05:21+00:00

I’m implementing an infinite-scroll, which means I’m appending chunks of content into the DOM

  • 0

I’m implementing an infinite-scroll, which means I’m appending chunks of content into the DOM (via jquery and javascript).

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.

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);

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.

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:05:22+00:00Added an answer on June 12, 2026 at 6:05 am

    the answer is QUIRKS MODE!

    a great reference: http://webdesign.about.com/cs/doctype/a/aaquirksmode.htm

    as a quick test, I changed my local settings (F12 in IE, and then change the ‘Document Mode’ from Quirks to IE9 standard), which fixed my scrolling issue!

    Without the doctype declaration, IE was defaulting to quirks mode which apparently makes it report incorrect heights on elements added to the DOM after pageload, which naturally makes scrolling unreliable. Also note that i was working in a frame inside a frame inside a frame, so the best place to specify the DOCTYPE for my content was in the OUTERMOST FRAME.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.