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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:57:10+00:00 2026-05-21T19:57:10+00:00

I’m not sure if this is possible, but I am trying to integrate a

  • 0

I’m not sure if this is possible, but I am trying to integrate a facebook-app like feature to my webpage where if you scroll beyond the top of the page it will refresh the page asynchronously.

All I need is a way to use a javasript/jquery/whateverelsewillwork to detect when the user scrolls up, even when the scrollbar is already at the top of the page.

regards,

taylor

  • 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-21T19:57:10+00:00Added an answer on May 21, 2026 at 7:57 pm

    If you want to do it, it is possible. All you need to do is to hook into the document’s events and do some special cases checking. It was only tested on Chrome and IE9, I’ll let you do the rest.

    If you want, you can use an existing jQuery mousewheel plugin instead to make your life easier. It should be more reliable if the plugin is kept up to date.

    $(function(){
        //This variable is used to prevent event flooding
        var preventRefire = false;
    
        //Bind all possible events
        $(document).bind("DOMMouseScroll mousewheel scroll keyup",function(event){
            //If an event was fired recently, return
            if(preventRefire) return;
    
            if(event.type == "keyup"){
                //If key is not up arrow or page up, return
                if(event.which != 38 && event.which != 33) return;
    
                //If an input field is focused, don't fire, return
                if($('input:focus,textarea:focus').length != 0) return;
            }
    
            if(event.type == "mousewheel" || event.type == "DOMMouseScroll"){
                //Guess scroll direction
                var deltaY = 0;
                if(event.wheelDelta) deltaY = event.wheelDelta;
                if(event.detail) deltaY = -event.detail;
    
                //If user mousewheeled down, don't fire, return
                if(deltaY <= 0) return;
            }
    
            //Finally, are we at the top?
            if($(document).scrollTop() == 0){
                //Prevent event to refire within 2 seconds
                preventRefire = true;
                setTimeout(function(){ preventRefire = false; }, 2000);
    
                //This is where you do your stuff
            }
        });
    });
    

    You can try a live demonstration here: http://jsfiddle.net/34p6B/2/

    Problems:

    It is somewhat reliable, just a couple of things to think about.

    It wasn’t tested on a mobile device, but the binding into the scroll event should handle it ok.

    Due to event bubbling, mousescroll events will fire on other elements. For example if you have scrolling content in a text area or element AND you’re at the top of the page, it WILL fire if you scroll the inner content up, even though it should not count as an “overscroll” on the document itself. In those cases you can use event.stopPropagation() on the scrolling elements’ mousewheel event to prevent this behaviour.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string

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.