0

I have set up the pages like this (using some php and jquery):

On this page, I have some tabs, using jquery to hide and display the content on click each tab. The url will change to #this_tab_name accordingly.

For example, www.mysite.com/thispage#tab1 will be showing the content of tab1 only when someone clicks tab1 on thispage.

Now I want to set up a footer site map, I want some of the menu items link directly to urls like www.mysite.com/thispage#tab1 and also display the right content while hiding the rest. Embedding "thispage#tab1" will only link to thispage, but without the right content.

Any suggestion? Many thanks!

0

You need to add your jquery to document.ready as well as click, that way when a user goes to the page it will load the proper tab for you.

Something like this:

jQuery(document).ready(
    function()
    {
        //bind click event
        jQuery("#tab1").click(show_tab);

        //handle document load
        show_tab();
    }
);

function show_tab()
{
    ...
}
| improve this answer | |
  • Thank you but I don't think this is the problem. everything is in the ready function now. The url just has no impact on the content jquery changes, I still don't know what to do with that. – the_summer_bee Sep 12 '13 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.