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

  • SEARCH
  • Home
  • 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 8445485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:40:24+00:00 2026-06-10T09:40:24+00:00

how do I find out if the user scrolled up to the top or

  • 0

how do I find out if the user scrolled up to the top or down to the bottom in a scrollable container?

Does jQuery offer any mechanisms?

css:

#container {
    display: block;
    width: 250px;
    height: 25px;
    background: green;
}
#scrolling {
    width: 250px;
    height: 300px;
    backround: red;
    overflow: auto;
}

http://jsfiddle.net/Hmaf2/2/

Thanks a lot!

Pat

  • 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-10T09:40:25+00:00Added an answer on June 10, 2026 at 9:40 am

    You can test the scroll position by comparing the height, scrollable height and scroll offset of the div:

    $(document).ready(function(){
        $('#scrolling').scroll(function(){
            var scrollTop = $(this).scrollTop();
            var iheight = $(this).innerHeight();
            var sheight = this.scrollHeight;
            var text = '';
            if (scrollTop <= 5) {
                text = 'top';
            }
            else if (scrollTop+5 >= sheight-iheight) {
                text = 'bottom';
            }
            else {
                text = scrollTop+' middle ('+iheight+','+sheight+')';
            }
            $('#result').text(text);
        });
    });
    

    fiddle
    This example has reserved 5 pixels from the top and bottom of the div’s margin.

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

Sidebar

Related Questions

Is it possible to find out when the user has scrolled to the bottom
Is there any way to find out does user have installed .NET Framework 2.0
Is there any way I can find out in my app if the user
How do I find out if a user has scrolled to the end of
Could anyone tell me how do I find out if user does not have
I want to find out how the User.IsInRole function works with Windows Authentication. Does
Is there any way to find out if the user pressed the delete key
How can I find out the currently logged on user then create a text
Is it possible to find out which page the user was previously browsing from
1)how can i find out the Windows Installation drive in which the user is

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.