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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:04:07+00:00 2026-05-25T02:04:07+00:00

Is it possible to send a mousevent down a z-axis? For example, an element

  • 0

Is it possible to send a mousevent down a z-axis?
For example, an element has been absolutely positioned on the site above another element. I would like the element below to get the mouseover event even though the other one is blocking it, and even though they are completely unrelated (no parent/child/sibling relationships going on).

This can happen on a good number of elements on the site I’m building, and I’d like a common approach to the problem without having to give some extra JS functionality to every single element that has the chance of this happening.

  • 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-25T02:04:08+00:00Added an answer on May 25, 2026 at 2:04 am

    First approach

    Listen for the mouse event on the element that is on top and trigger the one beneath.

    $('#thingOnTop').mouseenter(function(){
      $('#thingUnderneath').mouseenter();
    });
    

    This solution doesn’t address your requirement of having a general solution for all elements where this issue can occur. It will also not be entirely accurate, if the thing on top is not precisely the same position and dimensions as the thing underneath.

    Second approach

    Use the pointer-events CSS property. This will allow mouse events to go through things, but it is not supported in older browsers:

    .thingsOnTop{
        pointer-events: none;
    }
    

    Also note that this will make the thing on top never be the target of a mouse event, rather than in the first solution, where it would trigger the handler for the thing on top and the thing underneath.

    JoshNaro’s Fourth approach (elaborated)

    I was just in the process of adding another approach when Josh beat me to it. As he says, you could listen for the event on the top element and then programmatically find out which other elements are underneath that element for the event’s X and Y co-ordinates.

    HTML:

    <div class="thingThatCouldBeOnTop"></div>
    <div class="thingThatCouldBeUnderneath"></div>
    

    JS:

    $('.thingThatCouldBeOnTop').mouseenter(function(e){
        $('.thingThatCouldBeUnderneath').filter(function(){
            $this = $(this);
            var offset = $this.offset();
            var height = $this.outerHeight();
            var width = $this.outerWidth();
            return offset.top < e.pageY
                && offset.left < e.pageX
                && (height + offset.top) > e.pageY
                && (width + offset.left) > e.pageX;
        }).mouseenter();
    });
    
    $('.thingThatCouldBeUnderneath').mouseenter(function(){
        alert('do something more useful');
    });
    

    Please note: This is horribly inefficient. Reducing the set of searched elements to those with a given class helps somewhat (i.e. do $('.thingThatCouldBeUnderneath') rather than $('*')) but this means that you need to add that class to every element that could be underneath another that you want to handle mouse events for. I believe that it is the dimension calculations that causes the majority of the delay. With many potentially ‘underneath’ elements on the page, this could be too slow.

    Here’s a working example.

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

Sidebar

Related Questions

Is it possible to send a message over https that isn't encrypted? For example,
Is it somehow possible to send a function to another function for it to
Is it possible to send additional custom headers (for example with a wsgi app)
Is it possible to send large amount of data (grid content for example) in
Is it possible to send Push Notification from one iPhone Device to another? If
Is it possible to send an email from my Java application using a GMail
Is it possible to send messages from a PHP script to the console in
Is it possible to send a UDP broadcast packet to a different subnet through
Is it possible to send an Email with only cc or bcc recipients using
It is possible to send highlighted code directly to the F# interactive console in

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.