views:

59

answers:

1

I'm having trouble finding out how to set jQuery cookie for my tabs on this page: http://onomadesign.com/wordpress/identity-design/alteon-a-boeing-company/

My jQuery Tabs code is like this:

  $(document).ready(function(){
$(function () {
    var tabContainers = $('div.sc_menu_wrapper > div');

    $('a.tab').click(function () {
        tabContainers.hide().filter(this.hash).show();

        $('a.tab').removeClass('selected');
        $(this).addClass('selected');

        return false;
    }).filter(':first').click();
});});

So what piece of code do I need to make the last selected tab visible when visitors click on a different project. In other words: when people select a project from 'industry' tab, it should stay open on the next page.

I'm kinda lost here, any help would be great. Thankyou.

A: 

I don't know if I fully understand your problem but anyway here goes...

What you can do is hook up to tab clicked event (called select) and write a code to record the index, name or whatever that will allow you to identify the tab in a cookie. Then once your page refreshes and tabs are loaded again you can have a code to check if a cookie with this recorded value is present and force this tab to be displayed (with select method).

Notice the difference between select event handler link and select method link here.

RaYell
Thankyou. Yes I indeed want to force the page to display the tab with 'selected' class, from the cookie. But what is my code gonna be? I am really a noob programmer, I'm sorry. Could you paste in here the exact code that I should put in the php page?
Josh