Anders Hedeager
Anders Hedeager

Reputation: 117

Click on element behind image

I am facing some problems with my current system.

Check this picture: https://i.sstatic.net/Q221O.jpg I want to "click" behind the avatar to get the "item" (table) behind him. But i cannot, because of the picture is overlapping.

Here you can see the problem: https://i.sstatic.net/nM6nA.jpg

How should i do this? It is impossible? Or do i have to make it in HTML5 Canvas to make this work?

Upvotes: 1

Views: 637

Answers (2)

A. Wolff
A. Wolff

Reputation: 74420

Best way should be to use only CSS for this:

#avatarDiv{pointer-events:none;}

UPDATE

Following this comment,

I should also be available to rightclick on the "overlapping" picture, only the places where the image is transparent i should be available to catch the parent image.

this is no more a solution.

Upvotes: 2

Frederik.L
Frederik.L

Reputation: 5610

You could make the overlapping picture trigger his parent() click event. For example :

$('#myImage').click(function(){
    $(this).parent().trigger('click');
});

Upvotes: 0

Related Questions