2010-08-16 65 views
0

我是jquery和jquery ui的完整noob,但已成功實現了幾個ajax選項卡。我現在試圖將它與cookie持久性功能結合起來,以便頁面在返回到頁面時在最後打開的tabe處打開。代碼爲Ajax選項卡看起來是這樣的:jquery ui選項卡 - 使用ajax選項卡和cookie的持久性

<script type="text/javascript"> 
    $(function() { 
     $("#tabs").tabs({ 

      ajaxOptions: { 
       error: function(xhr, status, index, anchor) { 
        $(anchor.hash).html("Cannot load this tab at this time."); 
       } 
      } 
     }); 
    }); 
    </script> 

從文檔我得到如下的Cookie持久性被調用:

<script type="text/javascript"> 
$(function() { 
    $("#tabs").tabs({ 
     cookie: { 
      // store cookie for a day, without, it would be a session cookie 
      expires: 1 
     } 
    }); 
}); 
</script> 

的Al我嘗試在兩件事情結合起來的標籤結束根本不工作。我還讓我在周圍的用戶界面和一些幫助使用的語法頭,我一直在看這個時間太長,現在

回答

1

這不起作用???將不勝感激:

<script type="text/javascript"> 
    $(function() { 
     $("#tabs").tabs({ 
      ajaxOptions: { 
       error: function(xhr, status, index, anchor) { 
        $(anchor.hash).html("Cannot load this tab at this time."); 
       } 
      }, 
      cookie: { 
       // store cookie for a day, without, it would be a session cookie 
       expires: 1 
      } 
     }); 
    }); 
</script> 

你也有加載的cookie插件?

+0

我沒有意識到我需要cookie插件才能正常工作(doh!)。我一直在抨擊我的頭靠在牆上,認爲我的語法實際上已經搞亂了,而事實上我已經按照你的方式嘗試了它。我已經下載了cookie插件,並且看到它完美地工作。非常感謝 – Istari 2010-08-16 15:33:01

相關問題