There are different events during the opening and closing of modals on which you can attach javascript actions.
So if you need to trigger some custom javascript function or something in a 3rd party plugin, you can do that.

The available events are:

  • onOpen Event that fires right before the modal begins to open.
  • onLoad Event that fires right before attempting to load the target content.
  • onComplete Event that fires right after loaded content is displayed.
  • onCleanup Event that fires at the start of the close process.
  • onClosed Event that fires once the modal is closed.
{modal article="My Article" onOpen="alert('The modal is opening!');"}Alert when opening{/modal}
   
{modal article="My Article" onClosed="alert('The modal just closed!');"}Alert when closed{/modal}
   
{modal article="My Article" onOpen="console.log('onOpen');" onLoad="console.log('onLoad');" onComplete="console.log('onComplete');" onCleanup="console.log('onCleanup');" onClosed="console.log('onClosed');"}See the browsers console{/modal}