Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1047536
    amirwin1
    Participant

    Hello! Thank you for awesome theme, it’s always a pleasure to work with it.

    I’m using one-page navigation and I used this code to make proper navigation from other pages:
    https://community.theme.co/forums/topic/page-links-using-ids/page/3/#post-165513
    This works great, except all items are now highlighted and have the class “.current-menu-item”.
    Here is my site: http://f59.464.myftpupload.com/
    WP version: 4.5.2
    X version: 4.5.2
    Cornerstone: 1.2.4

    How can I fix it?

    Thanks!

    #1047893
    Friech
    Moderator

    Hi There,

    Thanks for writing in! Is this your page? https://www.abbyirwinmd.com/ URL you provided above redirects me on that site and I don’t see one page navigation setup in there. Please clarify.

    In the meantime, make sure your one page navigation menu is not set as the primary menu.

    Cheers!

    #1048187
    amirwin1
    Participant

    Hi, Friech!
    I disabled the Coming-soon redirecting plugin, now you should’ve access to the website, sorry for that! http://f59.464.myftpupload.com/

    I think it has fixed itself somehow. But I still have one issue.
    Steps to reproduce:
    1) Go to http://f59.464.myftpupload.com/
    2) Navigate to blog
    3) Navigate to “Pricing” (or any other except “Home”)
    4) The menu item is not highlighted, as it should.

    Is it possible to make the appropriate menu highlighted when navigating from another page?

    Thank you!

    #1048217
    Rue Nel
    Moderator

    Hello There,

    Thank you for the clarifications. I can confirm and replicate the issue you are having. Could you please let us know that you have create two separate menus? One should be exclusively used for one page navigation and the other as your primary menu.

    To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    To do this, you can make a post with the following info:
    – Link to your site

    – WordPress Admin username / password

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thank you.

    #1048283
    amirwin1
    Participant
    This reply has been marked as private.
    #1048747
    Rue Nel
    Moderator

    Hello There,

    Thanks for the very detailed information! I have checked your site and it turns out that you have set up the one page navigation incorrectly. And also this js code is causing an issue,

    
    
    // Conditions
    // 1. Menu should be using full url, eg. http://site.com/#x-content-band-1 and not just #x-content-band-1
    // 2. Use just one menu for both Primary and One Page.
    
    jQuery(function($){
    	
    	var window_base = window.location.href.split("#").slice(0)[0];
    	var window_hash = window.location.hash == '' ? 'body' : '#'+window.location.href.split("#").slice(-1)[0];
    	var outbound = /^https?:///i;
    
    	$('.x-nav a').each(function(){ //Scan links and convert them to relative hash for one page navigation's Active statuses to work properly when manually scrolling
    
    		var hash = /#/.test( $(this).attr('href') )  ? '#' + $(this).attr('href').split("#").slice(-1)[0] : '';
    		var anchor_base = /#/.test( $(this).attr('href') ) ? $(this).attr('href').split("#").slice(0)[0] : $(this).attr('href');
    
    	    if(hash) { //Does it have hash? then perform check
    		    if(anchor_base == window_base) { //If same page, then no need to reload, just make it relative
    		    	$(this).attr('href', hash);
    		    } // Else, leave it that way. So when user clicked, it will just link them to outbound page
    		}
    
    	}).click(function(e){ //Enable Parent and Submenu scrolling
    		
    		var hash = /#/.test( $(this).attr('href') ) ? '#' + $(this).attr('href').split("#").slice(-1)[0] : 'body';
            
    	    if(hash && !outbound.test( $(this).attr('href') ) ) { //Does it have relative hash?
    
    		    	e.preventDefault(); //Disable jumping
    		    	e.stopPropagation();
    
    		    	$('html,body').animate({ scrollTop: $( hash ).offset().top - $('.x-navbar').height()}, 700);
    
    		    	//Now add active status for automatic scrolling
    		    	$('.x-nav li').removeClass('current-menu-item');
    		    	$(this).parent().addClass('current-menu-item');
    
    		}
    
    	});
    
    	$('html,body').css({ scrollTop : 0});
    	setTimeout( function(){
    	$(document).ready(function(){ // Enable auto scroll when loaded.
    		$('.x-nav li').removeClass('current-menu-item');
    		//$('a:not([href*="#"])').parent().addClass('current-menu-item'); For experiment only
    
    		if(window_hash) {
    			$('a[href$="'+window_hash+'"]').click(); //Click it, so it will use default click from one page navigation event and submenu event
    		}
    	}); }, 300);
    
    });

    I temporarily removed the JS code and changed the menu settings. Right now, the indicator is now properly displaying in the correct section when it is displaying.

    #1049177
    amirwin1
    Participant

    Hi, Rue Nel!
    Everything works great, thank you very much for your help!

    #1049353
    Rupok
    Member

    You are welcome!

    Glad that it helped. Feel free to let us know if you face any other issue. We’ll be happy to assist you.

    Thanks for using X.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1047536 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>