[jQuery] Tabs and Cookies
Hello,
I am trying to implement the tabs jquery, but I would like for the
browser to remember the tab selected on page refresh.
Following details within another post, I have the following:
<code>
<head>
<link type="text/css" rel="stylesheet" href="ui.tabs.css">
<script type="text/javascript" src="jquery-1.2.1.pack.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<script type="text/javascript" src="ui.tabs.js"></script>
</head>
<script type="text/javascript">
var TABS_COOKIE = 'tabs_cookie';
$("#container-1 ul").tabs((parseInt($.cookie(TABS_COOKIE))
|| 1,{
onClick: function(clicked){
var lastTab = $
(clicked).parents("ul").find("li").index(clicked.parentNode) + 1;
$.cookie(TABS_COOKIE, lastTab);},
fxSlide: true,
fxFade: true,
fxSpeed: "normal"
});
</script>
<div id="container-1">
<ul>
<li><a href="#fragment-1"><span>News</span></a></li>
<li><a href="#fragment-2"><span>Jobs</span></a></li>
<li><a href="#fragment-3"><span>Branches</span></a></
li>
</ul>
<div id="fragment-1">
{news}
</div>
<div id="fragment-2">
${jobs}
</div>
<div id="fragment-3">
${branches}
</div>
</div>
</code>
But this does not work for me at all.
This code however works, which is the standard code from the demo.
<code>
<script type="text/javascript">
$(function() {
$('#container-1 ul').tabs({ cache: true });
});
</code>
What am I doing wrong?
Cheers
Norman