Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1333359

    hi there,

    i got a website with woocommerce and the themesetting for the product-gallery is set to “Woocommerce 3.0 Product galley”.

    unfortunally theres is no alt text showing on hover. website below.

    is it possible to add the avia.tooltip via functions.php to the product galley?

    greetz

    • This topic was modified 2 years, 11 months ago by volmering.
    #1333478

    Hey Ramon,
    Thank you for the link to your site, the closest I could come to your request is this script and css that shows the gallery image thumbnail alt tag on mouse-over:
    2021-12-19_005.jpg
    which works ok if the alt tag doesn’t contain too much text, since the image needs to be clickable to view the larger image above if there is too much text you can’t click the image.
    If you want to try this, add this code to the end of your functions.php file in Appearance ▸ Editor:

    function custom_gallery_tooltip_script() { ?>
        <script>
    (function($) {
    	setTimeout(function(){
      $("#top.single-product .flex-control-thumbs>li>img").wrap('<div class="alt-wrap"/>');
      $(".alt-wrap>img").each(function() {
        $(this).after('<span class="tooltip">' + $(this).attr('alt') + '</span>');
      });
    	},300);
    })(jQuery);
    </script>
        <?php
    }
    add_action('wp_footer', 'custom_gallery_tooltip_script');

    and this code in the General Styling ▸ Quick CSS field:

    .alt-wrap { 
      display: block;
      position: relative;
      margin: 0px;
    }
    .alt-wrap span.tooltip {
      opacity: 0;
      position: absolute;
      left: 0; right: 0; bottom: 0;
      margin: 0;
      color: #fff;
      padding: 5px;
      font-size: 10px;
      line-height: 12px;
      background-color: rgba(0,0,0,0.8);
      transition: all 300ms ease;
      transition-delay: 300ms;
    }
    .alt-wrap:hover > span.tooltip { 
      opacity: 1; 
      transition-delay: 0s;
    }

    Then clear your browser cache and any cache plugin, and check.

    Best regards,
    Mike

    #1333525

    hi mike,

    great work man. i appreciate your help on it. thanks!!!

    but unfortunally its not the solution. because we need here and then the longer names and clickable images (especially for mobile).

    greetz ramon

    #1333526

    Hi,
    Perhaps there is a plugin that will work for you such as Gallery Captions for WooCommerce

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Woocommerce 3.0 Product galley’ is closed to new replies.