beforeBoxEnd - callback function

Page: 1

Author Post
Registered: Apr 2015
Posts: 3

from the API documentation:
Some callback functions will receive an argument that is the active floatbox instance.

So, modifying your sample code (I'm creating in Javascript):
albumLink.setAttribute("data-fb-options", "beforeBoxEnd:`updateLightbox();`");

function updateLightbox( a ) {
console.log("updateLightbox: hello." + a);

This logs the output updateLightbox: hello.undefined

So how can I receive the active floatbox instance from the callback function?


Registered: Aug 2008
Posts: 3382
What you have provided in the callback is a javascript statement in string format which will execute verbatim. It is an invocation of the updateLightbox function with no parameters being passed, hence parameter 'a' in the function is undefined.

Reference the function, don't invoke it.
"beforeBoxEnd: updateLightbox"
Floatbox will find that defined global function and invoke it with a parameter of the current floatbox object.
Registered: Apr 2015
Posts: 3
Perfect... thankyou :)

Page: 1