pointer-events
/* Keyword values */
pointer-events : auto ;
pointer-events : none ;
pointer-events : visiblePainted ; /* SVG only */
pointer-events : visibleFill ; /* SVG only */
pointer-events : visibleStroke ; /* SVG only */
pointer-events : visible ; /* SVG only */
pointer-events : painted ; /* SVG only */
pointer-events : fill ; /* SVG only */
pointer-events : stroke ; /* SVG only */
pointer-events : all ; /* SVG only */
/* Global values */
pointer-events : inherit ;
pointer-events : initial ;
pointer-events : unset ;
| |
---|---|
| |
| |
| |
| |
grammar
value
auto -
And pointer-events The performance effect is the same when the attribute is not specified. For SVG content, this value is the same as visiblePainted Same effect none -
Element will never become a mouse event target (en-US) 。 However, when the pointer-events Property, the mouse event can point to a descendant element. In this case, the mouse event will trigger the event listener of the parent element during the capture or bubbling phase. visiblePainted -
Only applicable to SVG. An element becomes the target of a mouse event only if: visibility The attribute value is visible , and the mouse pointer is inside the element, and fill Property specifies none Value other than visibility The attribute value is visible , the mouse pointer is on the element boundary, and stroke Property specifies none Value other than
visibleFill -
Only applicable to SVG. Only in elements visibility The attribute value is visible , and the mouse pointer is inside the element, the element will become the target of the mouse event, fill Property does not affect event handling. visibleStroke -
Only applicable to SVG. Only in elements visibility The attribute value is visible , and the mouse pointer is at the element boundary, the element will become the target of the mouse event, stroke Property does not affect event handling. visible -
Only applicable to SVG. Only in elements visibility The attribute value is visible , and the mouse pointer is inside or at the boundary of the element, the element will become the target of the mouse event, fill and stroke Property does not affect event handling. painted -
Only applicable to SVG. An element becomes the target of a mouse event only if: -
The mouse pointer is inside the element, and fill Property specifies none Value other than -
The mouse pointer is on the element boundary, and stroke Property specifies none Value other than
visibility Property does not affect event handling. -
fill -
Only applicable to SVG. Only when the mouse pointer is inside the element will the element become the target of the mouse event, fill and visibility Property does not affect event handling. stroke -
Only applicable to SVG. Only when the mouse pointer is on the element boundary will the element become the target of the mouse event, stroke and visibility Property does not affect event handling. all -
Only applicable to SVG. Only when the mouse pointer is inside or at the boundary of the element will the element become the target of the mouse event, fill 、 stroke and visibility Property does not affect event handling.
Example
Example 1
/* Example 1: Makes all the img non-reactive to any mouse events such as dragging, hovering, clicking etc */
img {
pointer-events : none ;
}
Example 2
< ul >
< li > < a href = " https://developer.mozilla.org/ " > MDN </ a > </ li >
< li > < a href = " http://example.com " > example.com </ a > </ li >
</ ul >
a[href=" http://example.com "]
{
pointer-events : none ;
}
Tips
standard
|
---|
|
|
Browser compatibility
See
-
The SVG attribute pointer-events -
WebKit Specs PointerEventsProperty extended for use in (X)HTML content