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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:49:22+00:00 2026-05-15T03:49:22+00:00

UPDATE: Here is a jsbin example demonstrating the problem. UPDATE 2: And here is

  • 0

UPDATE:

Here is a jsbin example demonstrating the problem.

UPDATE 2:
And here is the fixed version thanks to fudgey.


Basically, I have the following javascript which scrolls the window to an anchor on the page:

 // get anchors with href's that start with "#"
 $("a[href^=#]").live("click", function(){
     var target = $($(this).attr("href"));
     // if the target exists: scroll to it...
     if(target[0]){
         // If the page isn't long enough to scroll to the target's position
         // we want to scroll as much as we can. This part prevents a sudden 
         // stop when window.scrollTop reaches its maximum.
         var y = Math.min(target.offset().top, $(document).height() - $(window).height());
         // also, don't try to scroll to a negative value...
         y=Math.max(y,0);
         // OK, you can scroll now...
         $("html,body").stop().animate({ "scrollTop": y }, 1000);
     }
     return false;
 });

It works perfectly……until I manually try to scroll the window. When the scrollbar or mousewheel is scrolled I need to stop the current scroll animation…but I’m not sure how to do this.

This is probably my starting point…

$(window).scroll(e){
    if(IsManuallyScrolled(e)){
        $("html,body").stop();
    }
} 

…but I’m not sure how to code the IsManuallyScrolled function. I’ve checked out e (the event object) in Google Chrome’s console and AFAIK there is not way to differentiate between a manual scroll and jQuery’s animate() scroll.

How can I differentiate between a manual scroll and one called via jQuery’s $.fn.animate function?

  • 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-15T03:49:23+00:00Added an answer on May 15, 2026 at 3:49 am

    Try this function:

    $('body,html').bind('scroll mousedown wheel DOMMouseScroll mousewheel keyup', function(e){
     if ( e.which > 0 || e.type == "mousedown" || e.type == "mousewheel"){
      $("html,body").stop();
     }
    })
    

    Also, did you see this tutorial?

    Update: Modern browsers now use “wheel” as the event, so I’ve included it in the code above.

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

Sidebar

Related Questions

Update : Here is the project. I have the following directory structure: RMI |
here's the example: http://jsbin.com/izegoy problem: https://i.stack.imgur.com/XSHZR.png script: $(document).ready(function(){ $(p:eq(1)).hide().after(<span>View more</span>); $(span).click(function(){ $(p:eq(1)).slideToggle(200,function(){ if($(span).text()==View more){
I have a query here regarding the value given to the update attribute of
I have this form which can insert/update values into database table. <div id=settingsdiv style=width:350px;
Here is an analogy of my problem(a selector which has this selector together with
I was following the tutorial here . The code I have is: - (void)
I have a GridView which has normal Edit/Update button. However, my GV RowUpdating, RowEditing
Update: Here's a similar question Suppose I have a DataTable with a few thousand
Update: here is a follow up question with colspans . I have a table
Edit: I'm using Ruby with Sinatra. UPDATE: here is the code I'm using which

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.