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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:57:45+00:00 2026-06-05T06:57:45+00:00

I was wondering if there is a function to be run after an element

  • 0

I was wondering if there is a function to be run after an element (e.g. div class=”myiv”) is hovered and check every X milliseconds if it’s still hovered, and if it is, run another function.

EDIT: This did the trick for me:
http://jsfiddle.net/z8yaB/

  • 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-05T06:57:46+00:00Added an answer on June 5, 2026 at 6:57 am

    For most purposes in simple interfaces, you may use jquery’s hover function and simply store in a boolean somewhere if the mouse is hover. And then you may use a simple setInterval loop to check every ms this state. You yet could see in the first comment this answer in the linked duplicate (edit : and now in the other answers here).

    But there are cases, especially when you have objects moving “between” the mouse and your object when hover generate false alarms.

    For those cases, I made this function that checks if an event is really hover an element when jquery calls my handler :

    var bubbling = {};
    bubbling.eventIsOver = function(event, o) {
    if ((!o) || o==null) return false;
    var pos = o.offset();
    var ex = event.pageX;
    var ey = event.pageY;
    if (
        ex>=pos.left
        && ex<=pos.left+o.width()
        && ey>=pos.top
        && ey<=pos.top+o.height()
    ) {
        return true;
    }
    return false;
    };
    

    I use this function to check that the mouse really leaved when I received the mouseout event :

     $('body').delegate(' myselector ', 'mouseenter', function(event) {
        bubbling.bubbleTarget = $(this);
    
        // store somewhere that the mouse is in the object
    
    }).live('mouseout', function(event) {
        if (bubbling.eventIsOver(event, bubbling.bubbleTarget)) return;
    
        // store somewhere that the mouse leaved the object
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering if there is some way to run a function every minute
I was wondering if there was a function in user32 that could enable a
Hi I was wondering if there is any jquery function around which can take
I was wondering if there are any difference between function __construct() { parent::__construct(); $this->load->
I'm just wondering if there is a best case to write this code: $('#set_duration_30').click(function(event)
Hi out there in Stackland. I was wondering if there was either a function
Firstly, I was wondering if there was some kind of built in function that
Hey, I'm just wondering if there's any easy function to make text suitable to
I'm currently using spidermonkey to run my JavaScript code. I'm wondering if there's a
I am wondering if there is a way to specify a php function or

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.