5

There is a semitransparent overlay div covering document which destroys on click, but I need somehow to trigger onlick events of the element beneath overlay at the same time. Is there a way to click on specific coordinates with JS, or maybe determine underlying element having absolute x and y positions? Thanks.

2
  • 4
    check out this answer to find the element by coordinates, and then trigger onclick on the found element: stackoverflow.com/questions/590119/… Commented Jul 16, 2010 at 21:01
  • would it be possible when the div element is added, you build a connection of the div element to the element above it. Then when the element above it is clicked, a handler is invoked for the div? Commented Jul 16, 2010 at 21:07

2 Answers 2

4

Nick has posted a link to awesome answer on how to get elements by x and y but unfortunately it's a comment so I can't accept it. :(

Sign up to request clarification or add additional context in comments.

2 Comments

It might return the semi-transparent div. May be excluding semi-transparent will do the work for you.
I already got it working as Nick posted his comment, but thanks.
1

If you can find out what is the element given the coordinates, you can always trigger the onclick handler yourself with jQuery using the .click() function.

1 Comment

Sure, but how to determine which element's events I have to trigger?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.