Overlays - globules-io/OGX.JS GitHub Wiki

Stack

From any Uxi, or object that extends the Overlay class

Adding

this.addOverlay(
      _CLOSE_ON_CLICK_, //Bool or Function, if the overlay hides itself on click/tap
      _ANIMATION_, //The animation to use to show/hide the overlay, 
      _DELAY_, //The timeout/delay defore the animation starts
 );

Example - Adding an overlay with a fade and expecting it to disappears if the user taps on it

 this.addOverlay(true, OGX.App.OVERLAY_FADE);

Example - Adding an overlay with no animation and ignore if the user taps on it

 this.addOverlay(false, false);

Special note on the delay parameter: if you animate other elements on top of a fading overlay (such as a popup, a menu), depending on the platform (Android or iOS), you might need to adjust the delay so the animation starts a bit after another animation. iOS is very sensitive to this. The value defaults to 350 (ms).

Removing

 this.removeOverlay(_ANIMATION_);

Removing a popup without passing an animation will use the animation used when the popup was created. Passing an animation overrides it.