Title: non-image link
Last modified: February 19, 2019

---

# non-image link

 *  Resolved [adijeff](https://wordpress.org/support/users/adijeff/)
 * (@adijeff)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/non-image-link/)
 * Thanks for a great plugin Arno.
 * I have captions that slide up over the image on hover and I want the user to 
   be able to click on the caption or the image to get the lightbox. I am over-riding
   the gallery shortcode with `post_gallery` filter.
 * Since the caption link does not contain an image, the lightbox does not open.
   I know this is as designed, but I wonder if there is a way to force the lightbox
   on text links using something like `class="force-lightbox"` on the link.
 * Currently my workaround is to add an image inside the caption link and hide it
   with css, but it is not a nice solution because it creates two images in the 
   lightbox.
 * Thanks for any thoughts on this.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Arno Welzel](https://wordpress.org/support/users/awelzel/)
 * (@awelzel)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/non-image-link/#post-11223469)
 * Indeed only links which contain an IMG element will be used, as you can see in`
   js/photoswipe.js` (be aware, that only the minimised version is queued for the
   frontent, so modifiying the non-minimized version will not change anything):
 *     ```
           var parseThumbnailElements = function(el) {
               var elements = $('body').find('a[data-width]:has(img)'),
       ```
   
 * Extending this to A elements which contain a certain attribute should not be 
   a problem at all. Do you have any example for the HTML output you generate? So
   I can test this in my development environment and see, what I can do.
 *  Thread Starter [adijeff](https://wordpress.org/support/users/adijeff/)
 * (@adijeff)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/non-image-link/#post-11227413)
 * Thanks Arno. The output would be something like this (simplified):
 *     ```
       <div id="unique-id" class="item">
         <div class="wrapper">
           <a href="full-size-image.jpg" data-width="2880">
             <img class="image" src="thumbnail.jpg" srcset="..." sizes="...">
           </a>
         </div>
         <div class="caption">
           <a class="force-lightbox" href="full-size-image.jpg" data-width="2880">
             <p>Image caption</p>
           </a>
         </div>
       </div>
       ```
   
 * It’s the `class="force-lightbox"` on the link inside the caption that would do
   the work.
    -  This reply was modified 7 years, 2 months ago by [adijeff](https://wordpress.org/support/users/adijeff/).
    -  This reply was modified 7 years, 2 months ago by [adijeff](https://wordpress.org/support/users/adijeff/).
 *  Plugin Author [Arno Welzel](https://wordpress.org/support/users/awelzel/)
 * (@awelzel)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/non-image-link/#post-11227569)
 * I thought this should be easy. But it is not :-(.
 * The problem: there would be two links to the same image element. And this is 
   something PhotoSwipe can’t deal with.
 * So sorry – no, your problem can’t be solved without changing the PhotoSwipe library
   itself.
 *  Thread Starter [adijeff](https://wordpress.org/support/users/adijeff/)
 * (@adijeff)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/non-image-link/#post-11227767)
 * Ah, OK – thanks for trying Arno. I appreciate your efforts.
 * It made me try a different approach, and I have a solution that is so easy it’s
   embarrassing:
 * I never knew about the `pointer-events` property, but if I add `pointer-events:
   none;` to the caption div, then the image link underneath becomes clickable **
   through** the caption. No need for the burden/complications of a hidden second
   image.
 * I hope that might help someone else.
 *  Plugin Author [Arno Welzel](https://wordpress.org/support/users/awelzel/)
 * (@awelzel)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/non-image-link/#post-11227927)
 * Thanks for the feedback. That helped me with my galleries as well 🙂
 * See for example:
    [https://arnowelzel.de/geburtstagsreise-2013](https://arnowelzel.de/geburtstagsreise-2013)

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘non-image link’ is closed to new replies.

 * ![](https://ps.w.org/lightbox-photoswipe/assets/icon-256x256.png?rev=2906302)
 * [Lightbox with PhotoSwipe](https://wordpress.org/plugins/lightbox-photoswipe/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/lightbox-photoswipe/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/lightbox-photoswipe/)
 * [Active Topics](https://wordpress.org/support/plugin/lightbox-photoswipe/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/lightbox-photoswipe/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/lightbox-photoswipe/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Arno Welzel](https://wordpress.org/support/users/awelzel/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/non-image-link/#post-11227927)
 * Status: resolved