Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, is is possible to show only specific content from a page in a colorbox when using the colorbox-load colorbox-inline?
For example I have a page with a single line of text. I want ONLY this text to display inside the colorbox, and not my whole page (navigation, footer etc).
Thanks!
Comments
Comment #1
frjo CreditAttribution: frjo commentedThat is exactly what "colorbox-inline" is for.
From the README:
Load inline content in a Colorbox:
----------------------------------
Check the "Enable Colorbox inline" option in Colorbox settings.
This enables custom links that can open inline content in a Colorbox.
Inline in this context means some part/tag of the current page, e.g. a div.
Replace "id-of-content" with the id of the tag you want to open.
Add the class "colorbox-inline" to the link and build the url like
this "?width=500&height=500&inline=true#id-of-content".
Comment #2
remkovdz CreditAttribution: remkovdz commentedThanks, but when I use that, it shows me the content within the DIV of the current page, not the linked page?
Comment #3
frjo CreditAttribution: frjo commentedIf you need to show content from another page than the current "colorbox-inline" is not for you.
The function you want is supported by the Colorbox plugin, see here:
https://groups.google.com/d/topic/colorbox/GnEAbkjekMk/discussion
There is no "point and click" support for it added to the Colorbox module yet so you will need to write some JS code yourself.
Comment #4
remkovdz CreditAttribution: remkovdz commentedGreat link, thanks!
Comment #5
frjo CreditAttribution: frjo commentedComment #6
HyperD CreditAttribution: HyperD commentedI'm interested also on this, but the link #3 is not longer reachable.
I cannot add javascript into any page/view due internal policies, thus I'm looking for something feasible with Colorbox
Comment #7
benjus CreditAttribution: benjus commentedHi there,
I'm trying to show a template inside a colorbox popup in Drupal 7.
The link that call the template is this:
print "<a class='casualty-link colorbox-inline ' href='/timeline/casualties-popup/".$conflict."/".$fullDate."'>$casualties[$currentDayPadded]</a>";
Inside the js addede to the tpl I have this line:
$('a.casualty-link').colorbox();
But it is not working, open the page in other in another page.
Do you know why?