craftyjs.github.com

Crafty.DOM

Collection of utilities for using the DOM.

Back to top

Crafty.DOM.window

Object with width and height values representing the width and height of the window.

Back to top

Crafty.DOM.inner

public Object Crafty.DOM.inner(HTMLElement obj)

obj
HTML element to calculate the position

Find a DOM elements position including padding and border.

Back to top

Crafty.DOM.getStyle

public Object Crafty.DOM.getStyle(HTMLElement obj, String property)

obj
HTML element to find the style
property
Style to return

Determine the value of a style on an HTML element. Notation can be in either CSS or JS.

Back to top

Crafty.DOM.translate

public Object Crafty.DOM.translate(Number x, Number y)

x
x position to translate
y
y position to translate

Returns

Object with x and y as keys and translated values

Method will translate x and y positions to positions on the stage. Useful for mouse events with e.clientX and e.clientY.