Is there a way to fire the colorbox inline functionality using ajax_command_invoke? I am trying to integrate another custom module with colorbox, and I have an ajax callback that is being fired. the page has a hidden div that I want to load in a colorbox when the ajax command returns. If, using the web tools console, I manually fire the colorbox, it works. Or if I create a link as the instructions demonstrate for loading inline content, it works, but I would like it to be fired with the ajax invoke method.
ajax_command_invoke seems to require a selector as the first argument though, and it looks like the colorbox command is on the jQuery object. Running:
ajax_command_invoke('jQuery' , 'colorbox', $arguments);
doesn't seem to work, nor does :
ajax_command_invoke(NULL , 'colorbox', $arguments);
Comments
Comment #1
meecect CreditAttribution: meecect commentedI did find a rather hacky way of making it work. If I just folow the inline example in the docs, then I can do:
$commands[] = ajax_command_invoke('#colorboxlink', 'click');
But that seems like a hacky workaround. The approach I am taking is that there is a div on the page (a node page) that is meant to be the inline content, and I want the ajax callback fired from the form on the page to display this content (after the rest of the callback has been completed, so I can't just put an action on the form submit button)
Another option is to build the html in my ajax callback and use the html features of colorbox, as I understand you can just provide it directly with html content in the 'html' option.
But either route requires me to be able to fire, or invoke, the colorbox function.
Comment #2
Neslee Canil Pinto