0

Hi...

I have a simple function for loading php pages into the index.php file. I'm wanting to incorporate pushstate() so I can start making the page crawlable. But not sure how.

Here's my starting point (which just gives me "http://www.site.com/undefined"

// function for navigation clicks

    $("#top_nav li a, #footer_info").on("click", function(e){

                // prevent the a href from doing what it naturally does.
                e.preventDefault();

                // highlight active nav link & turn off others              
                $('.current').attr('class','link1');



                // which page chosen?
                var loadpage = 'inc/'+$(this).attr('name')+'.php';
                var footer = 'inc/footer.php';



                    $('#main_center_box,#footer_links').stop().animate({ opacity: 0, zIndex:0 }, 700, function() { 
                        $(this).attr('class','current');

                        // now load the page that matches navigation selected
                        $('#main_center_box').css({zIndex:1 }).load(loadpage).stop().animate({ opacity: 1}, 700, function() { /* animation complete */ });
                        $('html,body').scrollTop(0);

                        // not sure how to do this part...
                        href = $(this).attr(loadpage);
                        history.pushState('', 'New URL: '+href, href);
                    });

    });

Edited by turpentyne

1
Contributor
1
Reply
8
Views
4 Years
Discussion Span
Last Post by turpentyne
0

good lord...

It helps if I have a url in the href.

Ok. that's solved. Now how to make things crawlable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.