简体   繁体   中英

jquery UI Tabs cookie - not redirecting when different tab selected

looked around here, but didn't find straightforward answer..

I'm using cookies, to store last selected tab:

$(function() {
        $( "#tabs" ).tabs({
            cookie: {expires: 365},
            load: function(event, ui) {
            //  console.log("load event ran");
                $('a', ui.panel).live("click", function() {
                       $(ui.panel).load(this.href);
                       return false;
                       });
            },
            select: function(event, ui) {
                var url = $.data(ui.tab, 'load.tabs');
                if( url ) {
                    location.href = url;
                    return false;
                }
                return true;

            /* var current_index = $("#tabs").tabs("option","selected");
            $("#tabs").tabs('load',current_index); */
            }
       });
    });

which does work, but after cookie is set and i try to select a different tab - it changes url in the address box of the browser, but doesn't actually go to the selected tab.

you can see both ways (one is commented) i tried to implement on select event, but both don't work.

please help?

fixed this by using redirect:

$("#tabs").bind('tabsshow',function(event, ui) {
            window.location = ui.tab;
        })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM