Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding Lightbox Attribute to CQ5 Image Anchor
    primarykey
    data
    text
    <p>I need to add <code>rel="lightbox"</code> to the anchor tag when you select a target image using either Image or TextImage component. The anchor tag is automatically generated by CQ, but I am unable to find where this happens, or more importantly, if there is a method I can call to add this string.</p> <p>I am looking over the Adobe documentation for the built-in Image component (<a href="http://dev.day.com/docs/en/cq/5-3/javadoc/com/day/cq/wcm/foundation/Image.html" rel="nofollow">http://dev.day.com/docs/en/cq/5-3/javadoc/com/day/cq/wcm/foundation/Image.html</a>), which I cloned and modified slightly for separate Lightbox use.</p> <p>Image object has <code>protected Map&lt;String,String&gt; getImageTagAttributes()</code>, and I hope there is some equivalent object for anchors in a class that I'm not aware of.</p> <p>Here is our current Image component that I used for reference.</p> <pre><code>&lt;%@ page import="commons.Doctype, wcm.api.components.DropTarget, wcm.foundation.Image" %&gt;&lt;% %&gt;&lt;%@include file="/apps/site/global.jsp"%&gt;&lt;% String alignment = properties.get("alignment", ""); Image image = new Image(resource); //drop target css class = dd prefix + name of the drop target in the edit config image.addCssClass(DropTarget.CSS_CLASS_PREFIX + "image"); if (!alignment.isEmpty() &amp;&amp; !alignment.equals("center")) image.addCssClass(alignment); image.loadStyleData(currentStyle); image.setSelector(".img"); // use image script image.setDoctype(Doctype.fromRequest(request)); // add design information if not default (i.e. for reference paras) if (!currentDesign.equals(resourceDesign)) { image.setSuffix(currentDesign.getId()); } if (alignment.equals("center")) { %&gt;&lt;div class="center"&gt;&lt;% } %&gt;&lt;% image.draw(out); %&gt;&lt;% %&gt;&lt;cq:text property="jcr:description" placeholder="" tagName="small"/&gt; &lt;% if (alignment.equals("center")) {%&gt; &lt;/div&gt; &lt;% } %&gt; </code></pre> <p>Right now I'm using jQuery to do the job, but I don't want to rely on scripting if possible.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload