Rob
Rob

Reputation: 23

Recreate the Google+ navigation with jquery

I am currently trying to recreate the google+ navigation to the left, where you can switch your streams.

I have got everything working except the functionality to show the menu opened at page reload , if the page that is being reloaded is part of the navigation items, which otherwise would be hidden by default.

Does anybody have an idea, how they are doing it and how to recreate the functionality using jquery?

Thnx!

Upvotes: 2

Views: 256

Answers (1)

Jimmy Sawczuk
Jimmy Sawczuk

Reputation: 13614

The general idea I'd try is using window.location.hash to both set your current location, and, on reload, figure out which set of elements should be expanded. When you cascade out a new menu, set the hash like so:

window.location.hash = '#whatever';

Then on reload, check the hash:

if (window.location.hash != "")
{
    if (window.location.hash == '#whatever')
    {
        load_whatever_set();
    }
}

Upvotes: 1

Related Questions