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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:16:03+00:00 2026-05-26T13:16:03+00:00

I have 2 HTML elements that sit in the exact same position(same x,y values

  • 0

I have 2 HTML elements that sit in the exact same position(same x,y values & same width & height). They also have the same z-index.

Both listen to left click events but because one sits over the other element, only one element ever receives a left click event. I use ele.addEventListener("mousedown", touchStart, false); to register/detect left clicks on the elements.

Is there a way to make sure that both elements receive the left click event/message even if they both sit in the same position?

Maybe if I change their z-index to different indexes then they will both receive the message?

  • 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-26T13:16:04+00:00Added an answer on May 26, 2026 at 1:16 pm

    You can use the pointer-events css property:

    .click-thru {
      pointer-events: none;
    }
    

    This will make it so that clicks on the element travel through to the element below it. However, the top element won’t get the click event, so this might not work for you.

    You can also try using a global click handler and document.getElementAtPoint to manually trigger the event on the both elements.

    // Example (with jQuery)
    $(document).click(function(e){
      var mouseX = e.pageX, mouseY = e.pageY;
      if(mouseIsOverElement(mouseX, mouseY, element1))
      {
        $(element1).click();
      }
      if(mouseIsOverElement(mouseX, mouseY, element2))
      {
        $(element2).click();
      }
    });
    
    // Possible implementation of mouseIsOverElement
    function mouseIsOverElement(x, y, ele)
    {
      var result = false;
    
      // Hide both
      $(element1).hide();
      $(element2).hide();
    
      // Show the target element
      $(ele).show();
    
      if(document.getElementAtPoint(x,y)===ele)
      {
        result = true;
      }
    
      $(element1).show();
      $(element2).show();
    
      return result;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add some HTML elements that have the same class name. So,
I have 2 HTML elements that are of the same type. One element has
I have two HTML elements that share the same space- when one is visible,
i have several common elements (components), that will generate some html. it seems my
I have created web pages where am using pixel to position various html elements.
I have html elements with class ajaxem that are ment to be used in
1) With Html elements that don’t have runat = server attribute, absolute and relative
I have a list of html elements that have some text. I need to
I have four html elements that when clicked I want to have a specific
Is it possible to have a continuous border around adjacent html elements that have

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.