doAction( “before_show_area” )

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Actions
  6. doAction( “before_show_area” )
DiviArea.doAction( 'before_show_area', area, hideIds );
DiviArea.doAction( 'before_show_area_{id}', area, hideIds );

Fires before an Area is displayed. The second parameter notifies the callback about Areas that will be hidden before the new Area is displayed.

The {id} part in the hook name is the sanitized area-ID (all lower case, dashes changed to underscores).

Params

area
(DiviAreaItem) The Area which will be displayed.
hideIds
(array) List of Area IDs that will be hidden before the new Area is displayed.

Examples

// Save a Cookie/localStorage detail when an Area is displayed. 
DiviArea.addAction( 'before_show_area', function( area, hideIds ) {
    var key = area.getKey() + '_state';
    DiviArea.Utils.setLocalData( key, 'open' );
});

Notes

The parameter hideIds contains values, when a Popup configuration is set to “Close other Popups: YES” and informs the callback about any Popup that is about to be closed.

Was this article helpful?

Related Articles