Support » Plugin: Easy FancyBox » Alt text of the image

  • Resolved Rahim

    (@rahimvaziri)


    Hi @ravanh
    Hope you are doing fine.

    I realized when I press the image, in the fancybox the alt text of the image will be shown if it’s defined.

    Is there any chance to show the caption too again like under the image?

    Because now I have to add the same value of caption to alt text to show the same texts.

    Regards,
    Rahim

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author RavanH

    (@ravanh)

    Hi Rahim, yes thanks. Hope you are doing fine too 🙂

    You could try this script in a Custom HTML widget in a footer zone (or sidebar):

    
    <script type="text/javascript">
    jQuery(document).ready(function($){
      $('a[href*=".jpg"],a[href*=".jpeg"],a[href*=".png"]').each(function(){
        var capt = $(this).parent().find('p.wp-caption-text').text();
        if (capt.length > 0) {
          $(this).attr('title',capt);
        }
      });
    });
    </script>
    

    Hi there,

    Thanks very much for the great plugin. How can I pull the photo or media’s description in the overlay instead of displaying the “alt text”?

    I tried the this code but it did not work. Thanks very much!

    <script type="text/javascript">
    jQuery(document).ready(function($){
      $('a[href*=".jpg"],a[href*=".jpeg"],a[href*=".png"]').each(function(){
        var capt = $(this).parent().find('p.gallery-item-description').text();
        if (capt.length > 0) {
          $(this).attr('title',capt);
        }
      });
    });
    </script>
    Plugin Author RavanH

    (@ravanh)

    Hi @hsaada it depends on how your images are embedded on the site and if the description text is present at all. If you can share a link to an example on your site, I can take a quick look.

    Thanks for looking into this. The photo description is available in the thumb view page but it’s hidden with CSS.

    Here’s a direct link: https://www.academyfence.com/codes-and-permits/new-jersey/morris-county/madison/

    (gallery is at the bottom of the page)

    Thanks again! 🙂

    Plugin Author RavanH

    (@ravanh)

    Ok, try replacing the $(this).parent() in the above script with $(this).closest('.gallery-item')

    Thanks man! it worked!! I tried to correctly traverse the DOM to get to it but wasn’t successful.

    Thank again and enjoy the rest of your day/night! 🙂

    Plugin Author RavanH

    (@ravanh)

    .parent().parent() might have worked as well 🙂

    Good to know! Thanks again for your help! 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.