• Resolved mchame

    (@mchame)


    URL in question: https://software-qa.sil.org/andika/

    I want to provide Creative Commons attributions for stock photos and have rel="lightbox" in several places:

    • Home page underneath big orange banner image via Edit Page
    • Home page underneath each square image via Caption within Image Widget

    These optional links are simple text hyperlinks that, when clicked, are supposed to open the images in popups. Here’s the weird part: the links within Image Widget captions ONLY work if there’s one created for the orange banner. If no CC attribution is needed for banner image, then none of the lightbox links in the Image Widgets work. They all have rel="lightbox" specified, but they are ignored, and clicking the links leaves the page and opens the image the old-fashioned way.

    I don’t have any custom CSS, JS or other WP widgets impacting these links, and they work perfectly fine elsewhere on the site. Chrome Web Inspector reveals the link syntax are exactly the same in both places, and these two areas are not related in any way. So why do the Image Widget lightboxes not work unless the banner image lightbox is specified?

    Thanks, Eddie

    https://www.ads-software.com/plugins/responsive-lightbox/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mchame

    (@mchame)

    UPDATE: I don’t know if this is related, but I did some investigating via Chrome and Firefox’s Dev Tools. We’re using the Nivo option and lightbox as the selector, so I looked at the JS call and find it uses $.each('a[rel*="lightbox"],a[data-rel*="lightbox"]') to locate each of my CC attribution links.

    Since it seems to not be picking up all the CC links, I tried running jQuery.each('a[rel*="lightbox"],a[rel*="lightbox"]').length in both browsers’ consoles and got the following error messages:

    • Chrome: `Uncaught TypeError: Cannot use ‘in’ operator to search for ‘length’ in a[rel*=”lightbox”],a[data-rel*=”lightbox”]
      `
    • Firefox: TypeError: invalid 'in' operand a

    But when I replace each with find, I do get the correct number of CC links in both browsers. So I’m wondering if the each might have something to do with my not being able to get Lightbox to work across the board.

    Could really use some help as I’ve wracked my brain over this for a couple of days now. Thanks!

    Thread Starter mchame

    (@mchame)

    UPDATE 2: Found a workaround. I will add a dummy CC link for the banner image, then HTML comment it out. That way, it stays hidden but allows other CC links on Home page to function correctly. Thanks anyway!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Lightbox only working some of the time in WP Image Widget captions’ is closed to new replies.