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 5962689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:08:27+00:00 2026-05-22T19:08:27+00:00

The same question is answered in jQUery but I’m looking for solution without jQuery.

  • 0

The same question is answered in jQUery but I’m looking for solution without jQuery.
How do you know the scroll bar has reached bottom of a page

I would like to know how I can determine whether vertical scrollbar has reached the bottom of the web page.

I am using Firefox3.6

I wrote simple Javascript loop to scroll down by 200 pixel and when the scroll bar reached the bottom of the page, I want to stop the loop.

The problem is scrollHeight() is returning 1989.

And inside loop scrollTop is incremented by 200 per iteration.

200 ==> 400 ==> 600 .... 1715

And from 1715, it won’t increment so this loop continues forever.

Looks like scrollHeight() and scrollTop() is not right way to compare in order to determine the actual position of scrollbar? How can I know when the loop should stop?

code:

var curWindow = selenium.browserbot.getCurrentWindow();
var scrollTop = curWindow.document.body.scrollTop;
alert('scrollHeight==>' + curWindow.document.body.scrollHeight);

    while(curWindow.document.body.scrollHeight > curWindow.document.body.scrollTop) {
      scrollTop = curWindow.document.body.scrollTop;
      if(scrollTop == 0) { 
        if(window.pageYOffset) { //firefox
          alert('firefox'); 
          scrollTop = window.pageYOffset; 
        } 
        else { //IE
          alert('IE'); 
          scrollTop = (curWindow.document.body.parentElement) ? curWindow.document.body.parentElement.scrollTop : 0; 
        } 
      } //end outer if
      alert('current scrollTop ==> ' + scrollTop);
      alert('take a shot here'); 
      selenium.browserbot.getCurrentWindow().scrollBy(0,200);

    } //end while
  • 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-05-22T19:08:28+00:00Added an answer on May 22, 2026 at 7:08 pm

    When you tell an element to scroll, if its scrollTop (or whatever appropriate property) doesn’t change, then can’t you assume that it has scrolled as far as is capable?

    So you can keep track of the old scrollTop, tell it to scroll some, and then check to see if it really did it:

    function scroller() {
        var old = someElem.scrollTop;
        someElem.scrollTop += 200;
        if (someElem.scrollTop > old) {
            // we still have some scrolling to do...
        } else {
            // we have reached rock bottom
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the same question as this but I'm looking for a classic ASP
I have seen the same question being answered for vb and c#, but i
There's already an answered question about the same subject but as it's from '09
I saw this same question for VIM and it has been something that I
The same as this question but for java Update Based on the comments and
This question is related to (but perhaps not quite the same as): Does Django
[This question is related to but not the same as this one .] My
I recently asked a question (and had it answered) here: jQuery Load JSON I
This may seem like a basic/stupid/obviously-answered question, but I wanted to check: why use
This is an extension to a previous question which was answered. But have a

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.