Modal JS API

The JS API is primarily configured through SA5's Modal Controller.

This is exposed dorectly through SA5 Core's controllers;

window.sa5.controllers.modals

Use Cases

These are some useful setups

Gated Modals

Use a form modal as a "gate" for content access.

  • User must fill in the form to proceed

  • When the user has passed the gate they see the content

  • They do not need to re-pass the gate

Drawing

Display a Modal

display(modalName: string, force: boolean) show the item

  • modalName is the name of the modal as defined by the wfu-modal attribute.

  • force = true, will display the modal even when it is marked as suppressed in cookies.

Example;

sa5.controllers.modals.display("modal1", true);  

Close all Modals

closeAll()

Example;

sa5.controllers.modals.closeAll();   

Close on submit

wfu-modal-trigger-close-formsubmit=""

Future

Link IFRAME to Modal automatic

Pre-defined modal default

v. Modal template

  • Pre-defined modals

  • Modals

  • Modal Templates

Content Source

pre-defined modal

  • Element-sourced

  • URL IFRAME-sourced

modal

Explicit

modal template

Last updated

Was this helpful?