Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1037751

    Hi Enfold Support,
    Last year we had issue with anchor links set up within tabbed content sections. You can see it here: https://kriesi.at/support/topic/anchor-links-not-scrolling-to-tab-section-tabs/
    The issue was how main nav menu links to the anchor links would not send the user to the tabbed content and or wouldn’t scroll down the page to the tabbed content (with the target tab opened). Is the custom script you provided is still relevant? Do we need to keep it or has subsequent updates to the theme addressed this issue?

    I ask as we’re seeing some problems with anchor links within the main nav menus not jumping to the right section of a page. Typically we put the anchor link in the custom ID area or the color section although the page is scrolling mid way within the color section cutting off half or 1/3 of the top of the color section.

    Would removing or adjusting the script below fix this? We’re also not seeing the browser “scroll” to the content within the page. Instead the browser quickly jumps to the content which is a bit jarring from a UI standpoint and confusing as the content isn’t fully visible. Thanks for your help. URLs and admin credentials are in private area.
    Eric

    // CUSTOM SCRIPT TO FIX ANCHOR LINKS TO TABBED CONTENT
    add_action( ‘wp_footer’, ‘ava_custom_script_tab_section’ );
    function ava_custom_script_tab_section() {
    ?>
    <script type=”text/javascript”>
    (function($) {
    function scrollToTab(s, e,) {
    $(s).on(e, function(event) {
    var anchor, loc, cur, hash, tab, parent, pos;

    if( e == ‘load’ ) {
    loc = window.location.hash;
    hash = loc;
    } else {
    loc = $(this).attr(‘href’);
    hash = loc.substring(loc.indexOf(‘#’));
    }

    tab = $(‘.av-section-tab-title[href=’+ hash +’]’);
    parent = tab.parents(‘.av-tab-section-outer-container’);
    pos = parent.offset();

    tab.trigger(‘click’);

    if(hash) {
    setTimeout( function() {
    $(window).scrollTop( pos.top – 100 )
    }, 500 );
    }
    });
    }

    scrollToTab( ‘.menu-item a’, ‘click’ );
    scrollToTab( window, ‘load’ );
    })(jQuery);
    </script>
    <?php
    }

    #1037846

    Ok, we’ve removed the custom script you provided and it fixed the scrolling to anchor link issues from the main nav menu. Although now the anchor links within tabbed content related to the previous support ticket, aren’t working. Any idea on how to have the main nav menu anchor links open a tab and go to the tabbed content on the same page if clicked within the main nav menu sub links?

    #1039740

    Hi,
    Sorry for the late reply, if I understand correctly the jumping to anchors is solved now by removing the above script, but you still need to solve the linking to tab section?
    Which page has the tab section? I didn’t see it on the “products” page.

    Best regards,
    Mike

    #1045374

    Were you able to get a fix for this? Playing around with 5 tabs last tab is a contact tab and if they click a link in the first I am trying to bring up the anchor in the last and not making any headway with the solutions offered.

    #1045395

    @Mike, sorry the tabbed content resides on a different page. See private area. You’ll note that if you’re on the page and decide to use the main global nav and select one of the links to the tabbed content, the browser doesn’t respond. The URL will change to add the /#tab but the browser doesn’t go to the tab.

    If you’re on a different page and click on the main nav to a specific tab, the browser will redirect to the tabbed content. Just doesn’t work when you’re on the page where the tabbed content resides.

    You’ll note that this also doesn’t work on your Enfold 2017 demo.

    The tab content element is demo’d here: https://kriesi.at/themes/enfold-2017/features/#blog-layouts

    But if you put another tab in the URL, the browser does nothing: https://kriesi.at/themes/enfold-2017/features/#icon-font-uploader

    Any idea what’s wrong? Thanks!
    Eric

    #1045711

    Hi,
    Sorry for the late reply, I believe the issue is that the links include a “/” for example if you are on the page and paste in:
    your-site.com/in-the-news#press-releases it goes to the tab but not as:
    your-site.com/in-the-news/#press-releases

    I found this same issue on quite a few stackoverflow questions about WordPress 1, 2, 3

    Two solutions I found are to remove the trailing slash via programmatically, or though the Permalink Settings

    Best regards,
    Mike

    #1045762

    Thanks Mike. The behavior is odd when the above fixes are added. When clicking on the tabs the URL structure is example.com/#tab-name and the browser slides to the destination tab without reloading the page. But if we make the change to the permalink or code the menu URLs with “example.com#tab-name”, it goes to the tabbed content but forces the browser to reload the page thus defeating the purpose of the tabs. Any way to simply have the tabs main menu function in the same fashion as simply clicking on the tabs–without a page reload? Thanks!

    #1046085

    Hi,
    I believe that the tabs are using Ajax to load the content without reloading the page, you could try using this plugin: Ajaxify WordPress Site to add this to your tab links in your menu.
    I have not tried this but the description sounds like what you are looking for.

    Best regards,
    Mike

    #1046388

    I’d rather not throw in another plugin if I can avoid it. It seems as if this should be possible without. Can’t we use a similar technique that allows the browser to scroll to color sections when an anchor link is in the main nav menu? This works well on other pages of the site ie the platform and activation pages.

    #1047894

    Hi,

    Unfortunately is not that simple, because those sections need to be triggered in a different way with Javascript…

    Best regards,
    Basilis

    #1047907

    Thanks Mike and Basilis. We’ll just leave as is for now. Intuitively the user should use the tabs to navigate between the tabbed content. And if we have a lot of content where the user needs to scroll, and they use the main nav they’ll just reload the page. Not ideal but works. Thanks again.

    #1048006

    Hi,
    Glad we were able to help, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads under Enfold sub forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Anchor Links within Main Nav Menu Not Working Properly & Old Customized Scripts’ is closed to new replies.