Pointer-Events
The
pointer-events property allows for control over how HTML elements respond to mouse/touch events – including CSS hover/active states, click/tap events in Javascript, and whether or not the cursor is visible.
While the
pointer-events property takes eleven possible values, all but three of them are reserved for use with SVG. The three valid values for any HTML element are:noneprevents all click, state and cursor options on the specified HTML elementautorestores the default functionality (useful for use on child elements of an element withpointer-events: none;specifiedinheritwill use thepointer-eventsvalue of the element's parent
pointer-events is to allow click or tap behavior to “pass through” an element to another element below it on the Z axis. For example, this would be useful for graphic overlays, or hiding elements with opacity (eg. tool tips) and still allowing text-selection on the content below it.Syntax
/* Keyword values */
pointer-events: auto;
pointer-events: none;
pointer-events: visiblePainted;
pointer-events: visibleFill;
pointer-events: visibleStroke;
pointer-events: visible;
pointer-events: painted;
pointer-events: fill;
pointer-events: stroke;
pointer-events: all;
/* Global values */
pointer-events: inherit;
pointer-events: initial;
pointer-events: unset;
Values
auto- The element behaves as it would if the
pointer-eventsproperty were not specified. In SVG content, this value and the valuevisiblePaintedhave the same effect. none- The element is never the target of mouse events; however, mouse events may target its descendant elements if those descendants have
pointer-eventsset to some other value. In these circumstances, mouse events will trigger event listeners on this parent element as appropriate on their way to/from the descendant during the event capture/bubble phases. visiblePainted- SVG only. The element can only be the target of a mouse event when the
visibilityproperty is set tovisibleand when the mouse cursor is over the interior (i.e., 'fill') of the element and thefillproperty is set to a value other thannone, or when the mouse cursor is over the perimeter (i.e., 'stroke') of the element and thestrokeproperty is set to a value other thannone. visibleFill- SVG only. The element can only be the target of a mouse event when the
visibilityproperty is set tovisibleand when the mouse cursor is over the interior (i.e., fill) of the element. The value of thefillproperty does not affect event processing. visibleStroke- SVG only. The element can only be the target of a mouse event when the
visibilityproperty is set tovisibleand when the mouse cursor is over the perimeter (i.e., stroke) of the element. The value of thestrokeproperty does not affect event processing. visible- SVG only. The element can be the target of a mouse event when the
visibilityproperty is set tovisibleand the mouse cursor is over either the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of thefillandstrokedo not affect event processing. painted- SVG only. The element can only be the target of a mouse event when the mouse cursor is over the interior (i.e., 'fill') of the element and the
fillproperty is set to a value other thannone, or when the mouse cursor is over the perimeter (i.e., 'stroke') of the element and thestrokeproperty is set to a value other thannone. The value of thevisibilityproperty does not affect event processing. fill- SVG only. The element can only be the target of a mouse event when the pointer is over the interior (i.e., fill) of the element. The values of the
fillandvisibilityproperties do not affect event processing. stroke- SVG only. The element can only be the target of a mouse event when the pointer is over the perimeter (i.e., stroke) of the element. The values of the
strokeandvisibilityproperties do not affect event processing. all- SVG only. The element can only be the target of a mouse event when the pointer is over the interior (i.e., fill) or the perimeter (i.e., stroke) of the element. The values of the
fill,strokeandvisibilityproperties do not affect event processing.
Comments
Post a Comment