I've been trying to get links to open in a colorbox, adding the attribute 'colorbox-load' to the CSS class but it doesn't seem to work; possibly because colorbox requires extra parameters such as width and height to be appended to the URL. Can anyone tell me how colorbox integration could be achieved?

Comments

spgd01’s picture

Subscribe

wjaspers’s picture

For simple forms Colorbox recognizes, use this format:
<a href="/colorbox/form/<form_identifier>?width=<pixels>&height=<pixels>" class="colorbox-inline">This will open a colorbox modal</a>
You also have to ensure the Colorbox module setting (admin/config/media/colorbox) for "Colorbox-inline" is enabled, or it won't be loaded into the <head> of the page.

EDIT: Sorry if I confused anyone. I was scouring drupal.org for Colorbox issues, and inadvertently thought this was in Colorbox' queue.

jcfiala’s picture

Category: feature » support

This sounds more of a support request than a feature request. sammyd56, does what wjaspers posted help you?

wjaspers’s picture

I think what he was asking is if a link could trigger a Colorbox automatically.

Actually, I have an idea. In newer versions of Views 7.x you can add class/id/rel info to link outputs. All you should need to do, is ste the link's class to "colorbox-load" or "colorbox-inline". If you need to link an iframe, just add &iframe=true to the rewriter information for the URL.

If you only need to display it in a particular situation, and the link is the only item being pulled together, or you don't want to use views to get it, wherever your template file contains your link field info, add
print l(t($varname['title']), ($varname['url']."?iframe=true"), array('class'=>'colorbox-inline'));

dqd’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

I'll close this issue due to inactivity for 12 years and upcoming EOL of Drupal 7 in January 2025. While the project version for Drupal 7 will keep providing support for security issues and website breaking bug fixes for Drupal 7, we should try to minimize the open issues for Drupal 7 in the queue as much as possible. Thanks for the report and all the efforts in here. Feel free to re-open if you can provide a fix or found an additional related problem which increases the issue priority to "Critical" here.