[Resolved] callback function

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Resolved] callback function

fabscanta
This post was updated on .
Hi,

I'm using the inline mode of Shadowbox.
I need to add event listeners on the DOM HTMLelements into the shadowbox.
I think the best way is to call a function at the end of Shadowbox.open.
Is there a way to init Shadowbox with a callback function ?

Something like that :

<script type="text/javascript"> document.observe('dom:loaded', function(){ Shadowbox.init({ loadingImage: "../img/loading.gif", overlayOpacity: 0.50, keysClose: [27], // key code for "esc" resizeDuration: 0.10, fadeDuration: 0.10, callback: function () { //myfunction } }); }); </script>
Or where can i add the callback into Shadowbox to call myfunction when Shadowbox is opened ?

Thks,

Fabien.
Reply | Threaded
Open this post in threaded view
|

Re: callback function

Wizzud
I don't quite grasp why you need it, or what you're trying to do with it, but can you not use either the onOpen or the onFinish option?
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: callback function

fabscanta
@ Wizzud,

Thks,

Maybe i can... I don't know... I thought onOpen and onFinish are used for gallery mode. Is it usefull with inline mode ?

Fabien.
Reply | Threaded
Open this post in threaded view
|

Re: callback function

Wizzud
Within the shadowbox code everything is actually a 'gallery' - it just does some extra stuff if there is more than one element in its current (internal) 'gallery'.
So, yes, with the exception of onChange (obviously), the 'on...' options still apply to non-Gallery mode, single element displays.
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: callback function

fabscanta
Wonderfull !

Thanks, it works fine !