i am extending tidypics here to improve the UI and decided to look at creating an AJAX lightbox popup using the colorbox system that comes with elgg. in my own case, on my site, i am probably going to need to run the 'onOpen' callback in colorbox to move the location of the colorbox elements in the rendered HTML file (using Jquery) due to specific issues with my theme. i found though, that i am unable to trigger the events in colorbox that are listed on the colorbox website, here:
the code i am using to call the colorbox popup is here: http://www.jacklmoore.com/colorbox/
$img = elgg_view_entity_icon($image, 'large', array(
'link_class' => 'elgg-lightbox',
'href' => 'ajax/view/ureka/image_popup?guid=' . $image->guid,
'data-colorbox-opts' => json_encode([
'height' => '96%',
'width' => '96%',
'fixed' => true,
'className' => 'imagebox' . $image->guid,
'onOpen' => "function() {alert('test'); console.log('open'); }",
]),
));
has anyone ever used this approach with colorbox in elgg and succeeded in getting the callbacks to be triggered? the other parameters i am assigning do appear to be applied when the page is rendered. thanks
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Steve Clay@steve_clay
Steve Clay - 0 likes
- Steve Clay@steve_clay
Steve Clay - 1 like
- ura soul@tunist
ura soul - 0 likes
You must log in to post replies.You can't get a function through JSON. You'll have to assign the onOpen programmatically.
Better: Listen for the "cbox_open" event fired on document. Then you can still let Elgg open the box.
i see, thanks steve. i was wanting to avoid adding yet another JS file to my site, but it looks like that's the only possibility.