Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #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.

    #1495802

    Hey 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

    #1495818

    I added the specified PHP code, but the behavior hasn’t changed. It’s still user-unfriendly and confusing.
    In addition to still needing to double-click the image above, the second click doesn’t always take me to the corresponding Accordion item.
    Please review it and let me know if you need FTP access.

    #1495881

    Hi,

    Thank you for the update.

    We tried accessing the page to check on the script behavior, but we’re currently not able to view the site because the SSL certificate appears to be invalid or expired. We would d need that resolved before we can properly test and debug the issue on our end.

    Could you please contact your hosting provider to get the SSL certificate corrected? Once the site is accessible over https, we can take a closer look at what’s happening with the horizontal gallery and the accordion anchor behavior and adjust the script accordingly.

    Let us know once the certificate issue has been fixed.

    Best regards,
    Ismael

    #1495910

    You can’t get the site cause was moved during last weeked. Please repoint to:
    (see private Content) with the same credentials as I sent you

    #1495934

    Hey!

    Thank you for the info.

    We tried logging to the site but the previous credentials are invalid.

    We adjusted the script a bit so it properly intercepts the click at the .av-horizontal-gallery-wrap level, check if the clicked target is an anchor pointing to a toggle or accordion item and override the default gallery behavior.

    Please replace the existing script in functions.php with this updated version:

    
    add_action( 'wp_footer', 'ava_wp_footer_script_mod', 99 );
    
    function ava_wp_footer_script_mod() {
        ?>
        <script>
        (function($) {
            $(document).on('click', '.av-horizontal-gallery-wrap', function(e) {
                var $anchor = $(e.target).closest('a[href^="#toggle-id-"]');
    
                if (!$anchor.length) return;
    
                e.preventDefault();
                e.stopImmediatePropagation();
    
                var href = $anchor.attr('href');
                var targetId = href.slice(1);
                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);
                }, 300);
            });
        })(jQuery);
        </script>
        <?php
    }
    

    Please make sure to purge the cache before testing. Let us know the result.

    Best regards,
    Ismael

    #1495951

    No, the problem hasn’t fixed
    Please review the page

    and see its erratic behavoir

    In Private Content adding access information

    #1496032

    Hi,
    I changed the script to this:

    function disable_horizontal_gallery_image_nav() { ?>
      <script>
    document.addEventListener('DOMContentLoaded', function() {
      document.querySelectorAll('.av-horizontal-gallery-wrap').forEach(function(wrap) {
        const link = wrap.querySelector('a[href^="#toggle-id-"]');
        if (!link) return;
    
        const href = link.getAttribute('href');
    
        wrap.style.cursor = 'pointer';
        wrap.addEventListener('click', function(e) {
          e.stopPropagation();
    
          const toggleId = href.replace('#', '');
          const toggleTrigger = document.querySelector('[data-fake-id="' + href + '"], [href="' + href + '"], #' + toggleId + ' .toggler, .toggle-title[href="' + href + '"]');
    
          if (toggleTrigger) {
            toggleTrigger.click();
    
            let scrollTimer = null;
            window.addEventListener('scroll', function onScroll() {
              clearTimeout(scrollTimer);
              scrollTimer = setTimeout(function() {
                window.removeEventListener('scroll', onScroll);
                window.scrollBy({ top: -250, behavior: 'smooth' });
              }, 300);
            });
    
          } else {
            window.location.hash = href;
          }
        });
    
        link.addEventListener('click', function(e) {
          e.preventDefault();
          e.stopPropagation();
        });
      });
    });
      </script>
      <?php
    }
    add_action( 'wp_footer', 'disable_horizontal_gallery_image_nav', 99 );

    Give it a try.

    Best regards,
    Mike

    #1496137

    That works perfectly. Many many Thanks!

    #1496138
    This reply has been marked as private.
    #1496142

    Hi,
    This is a sidebar widget:
    qhUzFee.md.png
    You can remove the widget shortcode or use this css to hide it:

    .single-product .sidebar #block-7 {
    	display: none;
    } 

    Let us know if this helps, if you have any further questions please open a new thread and we will try to help, we ask that each thread stays on one topic to be easier for everyone.

    Best regards,
    Mike

    #1496146

    Thank you! That worked perfect :D

    #1496148

    Hi,
    Glad that we could help, if you have further questions please open a new thread and we will try to help. Thanks for using Enfold.

    Best regards,
    Mike

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘The “Horizontal Gallery” and “Accordion” combination is malfunctioning.’ is closed to new replies.