Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1250859

    Hi,
    I have a problem on this page: https://leagrowingpeople.com/who-we-are/

    if I enter “our story” from the main menu I can enter.
    But if I am already on the “Who we are” page, for example in the first tab “our team”, and I want to go to “our story” from the main menu, I can’t access, why? That is, if I am already inside the “who we are” page and I want to move using the main menu to go from one tab to another I cannot do it.

    I also add a video to better explain: https://monosnap.com/file/pf0jZRJFtWvvFFP1qXzrz7mZwuB4RF

    I hope the problem is cleared up.

    Thanks for your continued support,
    Manuela

    #1252179

    Hey Manuela,

    Thank you for the inquiry.

    What you are looking for is possible but we have to use an additional script to open the appropriate tab section when a corresponding menu item is clicked. Please add snippet in the functions.php file.

    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 )
    				}, 1000 );
    			}
    		});
    	}
    	scrollToTab( '.menu-item a', 'click' );
    	scrollToTab( '.av-active-burger-items a', 'click' );
    	scrollToTab( window, 'load' );
    })(jQuery);
    </script>
    <?php
    }
    

    Best regards,
    Ismael

    #1252576

    Hi,
    I entered the function, but when I enter the 2 or 3 tab it takes time to go to that tab.
    Why?
    This is the link https://leagrowingpeople.com/ and the menu item to try is “Who we are” tab 2 “our methods”.
    Thanks for the support,
    Manuela

    #1253790

    Hi,

    Thank you for the update.

    It does not go immediately because it waits for the window or the page to load. Try to decrease the timeout duration in this block.

    setTimeout( function() {
    					$(window).scrollTop( pos.top - 100 )
    				}, 1000 );
    

    Replace 1000 with 100 ms to decrease the wait. It will still have to wait for the page to completely load though.

    Best regards,
    Ismael

    #1253846

    Hi,
    yes, it works for the time.
    But it not work if I’m already in the page try please: https://leagrowingpeople.com/who-we-are/
    Thank you for your support,
    Manuela

    • This reply was modified 4 years, 1 month ago by famarinu.
    #1254287

    Hi,

    We found a minor syntax error in the script and adjusted it a bit. It should be working properly now. Please purge the cache and remove the browser history prior to checking the page, or use incognito mode.

    Thank you for your patience.

    Best regards,
    Ismael

    #1258724

    Hi,
    now in this page: https://leagrowingpeople.com/who-we-are/ it works.
    Thank you for your support,
    Manuela

    • This reply was modified 4 years ago by famarinu.
    #1259154

    Hi,

    Great! Glad it is working. Please do not hesitate to open a new thread if you need anything else.

    Have a nice day.

    Best regards,
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘menu and tab section’ is closed to new replies.