-
AuthorPosts
-
December 18, 2021 at 1:24 pm #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.
December 20, 2021 at 1:38 am #1333478Hey 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:
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,
MikeDecember 20, 2021 at 12:14 pm #1333525hi 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
December 20, 2021 at 12:32 pm #1333526Hi,
Perhaps there is a plugin that will work for you such as Gallery Captions for WooCommerceBest regards,
Mike -
AuthorPosts
- The topic ‘Woocommerce 3.0 Product galley’ is closed to new replies.