Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make element unclickable (click things behind it)

I have a fixed image that overlays a page when the user is in the act of scrolling a touch screen (mobile).

I want to make that image "unclickable" or "inactive" or whatever, so that if a user touches and drags from that image, the page behind it still scrolls as if the image weren't there "blocking" the interaction.

Is this possible? If need be, I could try to provide screen shots exemplifying what I mean.

Thanks!

like image 298
hannebaumsaway Avatar asked Aug 06 '13 14:08

hannebaumsaway


People also ask

How do you make an element Unclickable?

Conclusion. To make an area unclickable with CSS, we set the pointer-events CSS property to none .

How do you make a background Unclickable in CSS?

To make a link unclickable using CSS, you can use the pointer-events property. Simply apply pointer-events: none; on the link that you want to make unclickable and it will not let you click the link.

How do you make an object Unselectable in HTML?

-webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none; However the mouse cursor will still change to a caret when over the element's text, so you add to that: cursor: default; Modern CSS is pretty elegant.


2 Answers

Setting CSS - pointer-events: none should remove any mouse interaction with the image. Supported pretty well in all but IE.

Here's a full list of values pointer-events can take.

like image 182
Chris Brown Avatar answered Sep 18 '22 04:09

Chris Brown


CSS Pointer Events is what you want to look at. In your case, set pointer-events to "none". Look at this JSFiddle for an example... http://jsfiddle.net/dppJw/1/

Notice that double clicking on the icon will still say you click the paragraph.

div.child {     ...         background: #fff;     pointer-events: none //This line is the key! }  
like image 35
Terry Avatar answered Sep 21 '22 04:09

Terry