DiviArea.Data.countVisibleAreas()

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Functions
  6. DiviArea.Data.countVisibleAreas()
DiviArea.Data.countVisibleAreas(filter)

Counts the number of visible Areas.

The filter is tested via DiviAreaItem.isType() to determine, which Areas to count.

Params

filter
(string, optional) A filter to limit Areas that are included in the callback loop.
Default: all

Returns

Number of currently visible Areas (integer).

Examples

// Count all visible Areas.
console.log( 'Visible Areas:', DiviArea.Data.countVisibleAreas() );

// Count all visible Popups.
console.log( 'Visible Popups:', DiviArea.Data.countVisibleAreas( 'popup' ) );

Notes

This method is used internally to determine, whether a Popup is visible or not. When no Popup is visible, the overlay is removed (via DiviArea.hideOverlay())

Was this article helpful?

Related Articles