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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:19:43+00:00 2026-06-05T04:19:43+00:00

If it possible to somehow write a snippet that during the scroll function on

  • 0

If it possible to somehow write a snippet that during the scroll function on the window the body is appended with a class?

$(window).scroll(function() {
    $('body').toggleClass('scrolling');
 });

If the user is scrolling then the body has a class of ‘scrolling’. If the scroll is not currently happening, the body has no class.

The scroll function seems to rapidly fire with the function above.

  • 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-05T04:19:45+00:00Added an answer on June 5, 2026 at 4:19 am

    There isn’t a “scroll start” and “scroll end” pair like “mouse down” and “mouse up”: the “scroll” event is more of a “scroll just occurred”. You can set a timeout to clear your “scrolling” class if no scroll has happened for n milliseconds:

    var scrollTimerId;
    
    $(window).scroll(function() {
        if (!scrollTimerId)
           $('body').addClass('scrolling');
    
        clearTimeout(scrollTimerId);
        scrollTimerId = setTimeout(function(){
            $('body').removeClass('scrolling');
               scrollTimerId = undefined;
        },150);
    });
    

    Demo: http://jsfiddle.net/8CaRE/2/

    (Vary the delay until you find something you’re happy with – for me 150ms seems a reasonable setting in Chrome.)

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

Sidebar

Related Questions

Is it possible to write similar construction? I want to set, somehow, default value
Is it possible somehow to ask the user to allow cross-domain access instead of
Is this possible somehow to generate a GUID in C#, that mostly corresponds to
Is it possible to somehow cancel xmlrpc client request? Let say that in one
I'm trying to write a function that can call a webmethod from a webserive
Is it possible somehow to define a constant that says what datatype to use
Is it possible to write a C# program that will load up a webpage,
Is it somehow possible to write active-x component on Java? Any library, tutorial and
Is it possible to somehow 'import' a new Java class into a running program
Is it possible to somehow forbid using templated function for types for which specialization

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.