-1

Does anyone know how to add a hyperlink in the description of an image in LightGallery once in open in the model box?

My code is:

<div id="portfolio-wrap" class="padding-sec-lg">
                            <ul id="portfolio" class="auto-construct  project-gallery" data-col="2">
                                <li  class="item"   data-src="img/Nicky.jpg" data-sub-html="<h6>Graphic Designer Site</h6><p>A website I created for  a graphic designer to showcase their work. Visit nicky.alexedmead.com for live site. </p>" >
                                    <a href="http://www.alexedmead.com" target="_blank">
                                    <img class="img-responsive" src="img/Nicky.jpg"  alt="Image description" />
                                    <span class="hover-cap">Graphic Designer Site</span>
                                    </a>
                                </li>
Alex
  • 11
  • 4

2 Answers2

0

You can add anchor tag inside data-sub-html attribute

<div id="portfolio-wrap" class="padding-sec-lg">
  <ul id="portfolio" class="auto-construct  project-gallery" data-col="2">
    <li  class="item"   data-src="img/Nicky.jpg" data-sub-html="<h6>Graphic Designer Site</h6><p>A website I created for  a graphic designer to showcase their work. Visit <a href='http://www.alexedmead.com' target='_blank'>alexedmead.com</a> for live site. </p>" >
      <a href="http://www.alexedmead.com" target="_blank">
        <img class="img-responsive" src="img/Nicky.jpg"  alt="Image description" />
        <span class="hover-cap">Graphic Designer Site</span>
      </a>
 </li>

Codepen Demo

Clr
  • 687
  • 7
  • 11
0

yep you're right, I figured out in the end that the anchor attributes need to use single quote marks ('') rather than double quote marks ("").

Alex
  • 11
  • 4