Property that keeps an object to manage the mouse cursor using a DOM element containing an image for clients that do not support changing the cursor image by CSS.
Caution: Performance could be dramatically decreased while using this workaround.
- Source:
Methods
-
<static> get() → {Element}
-
Gets the DIV element that contains the IMG element of the fake cursor (if any).
- Source:
Returns:
Returns the DIV element that contains the IMG element of the fake cursor (if any).
- Type
- Element
-
<static> getImage() → {Element}
-
Gets the IMG element of the fake cursor (if any).
- Source:
Returns:
Returns the IMG element of the fake cursor (if any).
- Type
- Element
-
<static> hide( [showNormalCursor])
-
Hides the fake cursor image.
Parameters:
Name Type Argument Default Description showNormalCursor
boolean <optional>
true If set to true, restores (shows) the system cursor (calls the
CB_Mouse.restore
function internally).- Source:
-
<static> isShowing() → {boolean}
-
Tells whether the fake cursor is showing or not
- Source:
Returns:
Returns whether the fake cursor is showing or not.
- Type
- boolean
-
<static> move( [x] [, y])
-
Moves the fake cursor image (if it is not hidden). Automatically called when the onMouseMove event is fired.
Parameters:
Name Type Argument Default Description x
number <optional>
CB_Mouse.getX(null, false) The X coordinate (horizontal position) in pixels where the fake cursor image wants to be moved to. If not provided, it will use the value returned by calling CB_Mouse.getX(null, false) internally.
y
number <optional>
CB_Mouse.getY(null, false) The Y coordinate (vertical position) in pixels where the fake cursor image wants to be moved to. If not provided, it will use the value returned by calling CB_Mouse.getY(null, false) internally.
- Source:
-
<static> set( [showCursorImage] [, cursorImage] [, cursorImageWidth] [, cursorImageHeight] [, hideNormalCursor] [, isSprite] [, numberOfFrames] [, framesMs] [, divElement] [, imageElement])
-
Uses an IMG element inside a DIV element (fakes the cursor) to simulate the mouse cursor (following its movements). If it was already called before and a fake cursor is already being used, the
CB_Mouse.CursorImage.hide
function must be called before in order to start using a different fake cursor image.
Caution: Performance could be dramatically decreased while using this workaround.Parameters:
Name Type Argument Default Description showCursorImage
boolean <optional>
true If set to true and a valid cursor image is given, the fake cursor functionality will be used. Otherwise, the fake cursor will stop being used.
cursorImage
string <optional>
If a valid image path is given and "showCursorImage" is set to true, the fake cursor functionality will be used with the given image. Otherwise, the fake cursor will stop being used.
cursorImageWidth
number <optional>
32 Width in pixels of the cursor image.
cursorImageHeight
number <optional>
32 Height in pixels of the cursor image.
hideNormalCursor
boolean <optional>
true If set to true, hides the system cursor (calls the
CB_Mouse.hide
function internally). Otherwise, shows the system cursor (calls theCB_Mouse.restore
function internally).isSprite
boolean <optional>
false Defines whether the cursor will be animated (using sprites) or not. If so, the cursorImage must be an image containing sprites horizontally (their individual width is defined by the "cursorImageWidth" parameter). Once the last sprite is reached, it returns to the first one automatically and continues to the next one again (without stopping).
numberOfFrames
number <optional>
1 Number of frames (sprites) being used from the cursor image ("cursorImage" parameter). Used when the "isSprite" parameter is set to true.
framesMs
number <optional>
100 Number of milliseconds between each frame (between one sprite and next one). Used when the "isSprite" parameter is set to true.
divElement
Element <optional>
CB_Elements.id('CB_fakeCursorImageDiv') The ID of the DIV element that will contain the image of the fake cursor (uses a DOM element with "CB_fakeCursorImageDiv" ID by default).
imageElement
Element <optional>
CB_Elements.id('CB_fakeCursorImage') The ID of the IMG element that will contain the fake cursor (uses a DOM element with "CB_fakeCursorImage" ID by default).
- Source:
- To Do:
-
- Allow defining an "onMove" parameter (a callback) to be able to call the "move" method with non-default parameters, etc.