This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.



Returns the horizontal coordinate of the event relative to the current layer. layerY is a non-standards property of the MouseEvent object.

Property of dom/MouseEventdom/MouseEvent


var result = element.layerY;
element.layerY = value;

Return Value

Returns an object of type NumberNumber

The scaled value of the mouse X and Y positions relative to the positioned elements’ client position. This may be an integer or double value depending on the viewport scale value.


Microsoft added the layerY property to the MouseEvent in IE9 for Interoperability purposes, but recommends using the offsetY property instead. The example below uses feature testing to detect IE9 and higher emulation modes and uses the event.offsetX value. For webkit and gecko and IE8 and lower emulation modes, the event.layerY or the event.offsetY values are used instead.

  form.layerXCoords.value = evt.offsetX;
  form.layerYCoords.value = evt.offsetY;
    form.layerXCoords.value = (evt.layerX)?evt.layerX:evt.offsetX;
    form.layerYCoords.value = (evt.layerY)?evt.layerY:evt.offsetY;


 Determining the relative mouse position on scrollable web pages.



A positioned element is an element whose position property is set to relative, absolute or fixed. For more information about element positioning, see About Element Positioning. Note This property is provided for cross-browser compatibility. Use y instead.


Standards information

There are no standards that apply here.