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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:19:05+00:00 2026-06-10T03:19:05+00:00

My page has a scrollable area which contains a number of elements. Each element

  • 0

My page has a scrollable area which contains a number of elements. Each element triggers a function when hovered over.

My issue is that if the user scrolls up or down with their mousewheel, the function triggers for every element that the cursor passes over as the area scrolls by underneath.

Is there a way that I can have the function trigger on hover only if the user is not actively scrolling?

jQuery’s built-in .scroll() doesn’t seem to be what I need, since the scroll event is triggered only when a scroll starts. I need to know if the scroll is “in progress” so to speak.


UPDATE: Here’s my current code:

$container.find('div.item').each(function(i, e){
     $(e).hover(
          function(){
               $(this).toggleClass('expanded');
               // other functions here
          },
          function(){
               $(this).toggleClass('expanded');
          }
     );
});

So what I want to do is disable everything in .hover() if the user is currently scrolling the page.

  • 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-10T03:19:07+00:00Added an answer on June 10, 2026 at 3:19 am

    I would use the setTimeout with a fair time on mouseenter and then clearTimeout on mouseleave, which would create an small delay on the hovers, so the hover only would trigger when the user holds his mouse over the element for the set time.

    This would hopefully minimize your scrolling problem. There might be a better solution than this, but it was the first thing I thought of.

    EDIT

    Wrote this example quickly, should work fine:

    $(function() {
        "use strict";
        var $container = $("#container"),
            timeout, self;
    
        $container.find("div").each(function() {
            $(this).hover(
                function() {
                    self = this;
                    timeout = setTimeout(function() {
                        $(self).css({
                            width : 500,
                            height: 500
                        });
                    }, 500);
                },
                function() {
                    clearTimeout(timeout);
                    $(this).css({
                        width : 300,
                        height: 300
                    });
                }
            );
        });
    });
    

    For a demo go to this fiddle: http://jsfiddle.net/sQVe/tVRwm/1/

    It’s up to you how much of an delay you want, I used 500ms.

    NOTE

    The .each() is not needed, you could call the .hover() on the div collection right away. I included .each() because I don’t know if you want to do more than just binding the hover event.

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

Sidebar

Related Questions

The page has a container div which holds multiple content divs. Each content div
Page has rows which is positioned relative. Each row has col1 and col2 which
my Page has many hover images, sometimes there are backgrounds from div-elements or src
Currently my page has a submit button which is disabled when it is clicked,
Our page has a datatable which shows records from a web service. The web
A page has elements without id - only with names. How to access them
I am making a small div on the center of the page which has
Page has menu items that would replace a 'div id=foo_(current menu item)' with 'div
This page has been quite confusing for me. It says: Memory management in newLISP
My page has about 25 radio button groups. When a radio button is selected

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.