Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #536443

    Seems like my previous thread will not be answered anymore, so i’ll repost it.
    https://kriesi.at/support/topic/link-to-tab-in-navbar-scrolls-down-the-page/

    Hello

    First of al I would like to say I really love the theme and it’s a pleasure to work with.
    However I am having some difficulties with links to a tab.

    I’ll try to explain a little bit better.
    I have a page called “about us” and this page displays 3 tabs using the “tabs content element”
    “Profile” “Recommendation” and “Competences”.

    If I navigate towards “about us” the first tab wil display just fine. However I want to add an option in the menubar to directly navigate to the second and third tab.

    I added those in the menu with a custom link
    http://www.agtp.org/about-us/ for “Profile”
    http://www.agtp.org/about-us/#tab-id-2 for “Recommendation”
    and http://www.agtp.org/about-us/#tab-id-3 for “Competences”.

    The first one works just fine. The second and third don’t.
    When i click the link i get navigated to the right tab but the page scrolls down a bit automatically.
    So the top half of the page is not visible and you have to scroll up to start at the top of the page.

    It happens when I deactivate all plugins as well.

    I hope I have explained this in a way you can understand the problem.
    If not you can have my login info to see for yourself.

    With kind regards,
    Daan

    #537921

    Hey Bespokedesign!

    Thank you for using Enfold.

    Please try this in the functions.php file:

    // ava_custom_scroll
    add_action('wp_footer', 'ava_custom_scroll');
    function ava_custom_scroll(){
    ?>
    <script>
    (function($){
        $('#top .av-main-nav .sub-menu a[href*="tab-id"]').on('click', function() {
    		var tab = $('#top .tabcontainer').offset();
    
    		$('body').animate({
    			scrollTop: tab.top / 2
    		}, 2000);
    	});
    })(jQuery);
    </script>
    <?php
    }

    Go the about page then click the menu items.

    Best regards,
    Ismael

    #544064

    Sorry it’s still not working how it’s supposed to.

    #546196

    Hi!

    Alright. Please remove the modification then modify the js >shortcodes.js file. Look for this code around line 2672:

    scoll_target = el_offset - 50 - parseInt($('html').css('margin-top'),10);
    

    .. replace it with:

    scoll_target = el_offset - 150 - parseInt($('html').css('margin-top'),10);
    

    Best regards,
    Ismael

    #546783

    sorry, this also didn’t fix the issue.

    #558225

    guys?

    #558240

    Hey!

    can you please add the second code and we can see the page live?

    Best regards,
    Basilis

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.