-
Notifications
You must be signed in to change notification settings - Fork 82
Callbacks reference
okonet edited this page Aug 25, 2010
·
1 revision
This page describes callbacks available for use in ModalBox.
There are couple of callbacks supported by ModalBox. Here they are:
- beforeLoad — fires right before loading contents into the ModalBox. If the callback function returns false, content loading will skipped. This can be used for redirecting user to another MB-page for authorization purposes for example.
- afterLoad — fires after loading content into the ModalBox (i.e. after showing or updating existing window).
- beforeHide — fires right before removing elements from the DOM. Might be useful to get form values before hiding modalbox.
- afterHide — fires after hiding ModalBox from the screen.
- afterResize — fires after calling resize method.
- onShow — fires on first appearing of ModalBox before the contents are being loaded.
- onUpdate — fires on updating the content of ModalBox (on call of Modalbox.show method from active ModalBox instance).
IMPORTANT NOTICE. Each callback is being removed from options of the ModalBox after execution.
- Modalbox.show(url, {*afterLoad: function() { alert(‘Content loaded successfully’) }* }); – after contents of the page located at specified URL will be loaded into ModalBox, alert will appears on the screen.
- Modalbox.hide({*afterHide: function() { alert(‘Modalbox is now hidden’) }* }); – you can pass callback to any ModalBox method (show, hide, resize). This will show alert after ModalBox disappears.