API Docs for: v0.8.0
Show:

Collision Class

Detects collisions between a DOM element against other DOM elements or Coords objects.

Constructor

Collision

(
  • el
  • colliders
  • [options]
)
Object

Parameters:

  • el HTMLElement

    The jQuery wrapped HTMLElement.

  • colliders HTMLElement | Array

    Can be a jQuery collection of HTMLElements or an Array of Coords instances.

  • [options] Object optional

    An Object with all options you want to overwrite:

    • [overlapping_region] String optional

      Determines when collision is valid, depending on the overlapped area. Values can be: 'N', 'S', 'W', 'E', 'C' or 'all'. Default is 'C'.

    • [on_overlap_start] Function optional

      Executes a function the first time each collider is overlapped.

    • [on_overlap_stop] Function optional

      Executes a function when a collider is no longer collided.

    • [on_overlap] Function optional

      Executes a function when the mouse is moved during the collision.

Returns:

Object:

Collision instance.

Item Index