LC Lightbox has got also several callbacks triggered during its operations.
Callbacks have to be used right on plugin's initialization.
Here's an example showing the full callbacks list:
<script type='text/javascript'> $(document).ready(function() { $obj = lc_lightbox('#lcl_elems_wrapper a', { option1 : 'value1', option2 : 'value2', ... elems_parsed : function(opts, vars) {}, // Triggered when targeted DOM elements have been managed (indipendently from lightbox opening) html_is_ready : function(opts, vars) {}, // Triggered when lightbox's HTML code is appended to page on_open : function(opts, vars) {}, // Triggered on first lightbox opening: right BEFORE lightbox element is displayed on_elem_switch : function(opts, vars, new_el_id) {}, // Triggered right before lightbox element's switch. new_el_id contains the element's index to be shown next slideshow_start : function(opts, vars) {}, // Triggered on slideshow start slideshow_end : function(opts, vars) {}, // Triggered on slideshow end on_fs_enter : function(opts, vars) {}, // Triggered on fullscreen mode enter on_fs_exit : function(opts, vars) {}, // Triggered on fullscreen mode exit on_close : function(opts, vars) {} // Triggered on lightbox closing. HTML and variables are still accessible }); }); </script>
There are two fixed arguments passed to these functions:
- opts
- Object containing managed lightbox options
- vars
- Object containing various objects and variables used by the lightbox instance
They are essentially equal to use global variables (check the related chapter to know more).