DiviArea.Data.getVisibleArea()

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Functions
  6. DiviArea.Data.getVisibleArea()
DiviArea.Data.getVisibleArea(id, type)

Returns either the top-most visible Area, or the Area with the given ID.

Params

id
(string, optional) The Area ID to fetch; empty for the top most entry.
type
(string, optional) The Area type to filter for – the function returns the top-most visible area of the given type.
Default: all

Returns

Returns the DiviAreaItem object that matches the id and type parameters. If no such visible Area was found, the function returns false.

Examples

// Get the top-most visible Area of any type.
DiviArea.Data.getVisibleArea();

// Get the top-most visible Fly-In.
DiviArea.Data.getVisibleArea('', 'flyin');

// Check, if the Area `#sample' is visible.
if ( DiviArea.Data.getVisibleArea('#sample') ) {
  console.log('Sample Area is visible');
}

Notes

No notes

Was this article helpful?

Related Articles