Use scrollTo in navigation menu

Community Forums Forums General Discussion Use scrollTo in navigation menu

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Susan 7 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #87159

    williamminty
    Member
    Post count: 1

    Good afternoon guys,
    I’m new to the Genesis Framework and have purchased the Agency Pro child theme.

    I’ve created a nav-menu that looks more or less like this:
    HTML

    <nav class="nav-primary">
    	<ul>
    		<li><a href="index.php#about-us">About Us</a></li>
    		<li><a href="index.php#talent">Talent</a></li>
    		<li><a href="index.php#contact">Contact</a></li>
    		<li><a href="blog.php">Blog</a></li>
    	</ul>
    </nav>

    On the index.php page (landing page), I want the scrollTo script to kick in, so I need the #id’s to make that work. But I don’t want the browser to reload. To try and dodge that, I created a small jquery script

    /* Adjust scrollTo based on page location
    	-------------------------------------------- */
    	var pathArray = window.location.host,
    		menuScrollTos = $('a[href*="index.php"]');
    
    	if(pathArray == "localhost" || pathArray == "showponies.co.nz") {
    		//rewrite menu item hrefs if page == localhost
    		menuScrollTos.each(function() {
    			//* Rewrite href to just the ID
    			var link = $(this).attr('href'),
    				id = '#' + link.split("#")[1];
    
    			$(this).attr('href', id);
    		});
    	}

    Unfortunately the scrollTo script still doesn’t kick in.

    I figure I need the ‘index.php’ before the id or if I’m on the Blog page (blog.php), then the links won’t go anywhere as the id’s won’t exist.

    This is really doing my head in, so it’d be great if someone out there could help out!

    Thanks in advance!

    #99137

    Susan
    Moderator
    Post count: 9406

    Did you ever get this figured out? I’d be happy to escalate if you are still looking for resolution.


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.