开发者

jQuery Tabs; cookie trouble

开发者 https://www.devze.com 2022-12-18 07:23 出处:网络
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/

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 sh开发者_如何学JAVAould stay open on the next page.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消