Tagged: Accordion, horizontal gallery
-
AuthorPosts
-
March 5, 2026 at 1:35 pm #1495776
Please see:
Among other pages that use this interface (see the bottom section of that page, green background), there’s a “Horizontal Gallery” that, when clicked (which is already strange because I have to click twice), should take me to the “Accordion” item. Not only does it sometimes work incorrectly, but it also takes me to the item description instead of displaying the item title (subsequent images don’t even take me to the item). I request that you review this issue, please.
March 6, 2026 at 6:12 am #1495802Hey tchamp77,
Thank you for the inquiry,
This is to be expected, since the default behavior when clicking an inactive Horizontal Gallery item is to navigate or slide it to the center. This behavior overrides the anchoring to the Accordion items. Once the image is centered, the anchor should work without issue.
To override this behavior, you can try this script in the functions.php file:
<?php add_action( 'wp_footer', 'ava_wp_footer_script_mod', 99 ); function ava_wp_footer_script_mod() { ?> <script> // override default horizontal gallery clicks behavior to open accordion and scroll to title (function($) { $(document).on('click', '.av-horizontal-gallery-slider a[href^="#toggle-id-"]', function(e) { e.preventDefault(); e.stopImmediatePropagation(); var targetId = $(this).attr('href').slice(1); setTimeout(function() { var $title = $('#toggle-toggle-' + targetId); var $wrap = $('#' + targetId); if (!$title.length) return; if (!$wrap.hasClass('active_tc')) $title.trigger('click'); setTimeout(function() { $('html, body').animate({ scrollTop: $title.offset().top - 80 }, 500); }, 50); }, 50); }); })(jQuery); </script> <?php }Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.
