Reference cursor()

cursor()

Changes the cursor's appearance.

The first parameter, type, sets the type of cursor to display. The built-in options are ARROW, CROSS, HAND, MOVE, TEXT, and WAIT. cursor() also recognizes standard CSS cursor properties passed as strings: 'help', 'wait', 'crosshair', 'not-allowed', 'zoom-in', and 'grab'. If the path to an image is passed, as in cursor('/assets/target.png'), then the image will be used as the cursor. Images must be in .cur, .gif, .jpg, .jpeg, or .png format and should be at most 32 by 32 pixels large.

The parameters x and y are optional. If an image is used for the cursor, x and y set the location pointed to within the image. They are both 0 by default, so the cursor points to the image's top-left corner. x and y must be less than the image's width and height, respectively.

Examples

Syntax

cursor(type, [x], [y])

Parameters

type
String|Constant:

Built-in: either ARROW, CROSS, HAND, MOVE, TEXT, or WAIT. Native CSS properties: 'grab', 'progress', and so on. Path to cursor image.

x
Number:

horizontal active spot of the cursor.

y
Number:

vertical active spot of the cursor.

Notice any errors or typos? Please let us know. Please feel free to edit src/core/environment.js and open a pull request!

Related References