Hi
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?
Thanks!
Ben.
beforeBoxEnd - callback function
Page: 1
Author | Post |
---|---|
#1 Wed Apr 15, 2015 12:31 pm
|
|
Member
Registered: Apr 2015
Posts: 3
|
|
#2 Wed Apr 15, 2015 4:48 pm
|
|
Administrator
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. |
#3 Tue Apr 21, 2015 4:49 am
|
|
Member
Registered: Apr 2015
Posts: 3
|
Perfect... thankyou
|
Page: 1