Hey,
I am trying to get this working but failing!
I am trying to make it so when you click the heading it opens the nab to do with that heading, and remember it... so next time you go onto the site it will remember what tabs you had open at the time... but its not working. If anyone has any Ideas that would be grand.
The JS
I do have the jQuery script included and the cookie jquery files
<script type="text/javascript">
$(document).ready(function(){
// Open / Close Panel According to Cookie //
if ($.cookie('panel') == 'open'){
$('ul').slideDown('fast'); // Show on Page Load / Refresh with Animation
$('ul').show(); // Show on Page Load / Refresh without Animation
} else {
$('ul').slideUp('fast'); // Hide on Page Load / Refresh with Animation
$('ul').hide(); // Hide on Page Load / Refresh without Animation
}
// Toggle Panel and Set Cookie //
$('#sidebar .head').click(function(){
$('ul').slideToggle('fast', function(){
if ($(this).is(':hidden')) {
$.cookie('panel', 'closed');
} else {
$.cookie('panel', 'open');
}
});
});
});
</script>
The HTML
<div id="sidebar" class="sidebar-left">
<div class="section">
<a href="?" class="head">Dashboard</a>
<ul>
<li><a href="?page=edit_details" class="">Edit Details</a></li>
<li><a href="?page=search" class="">Search</a></li>
</ul>
<a href="?" class="head">Clients</a>
<ul>
<li><a href="?page=new_client" class="">New Client</a></li>
<li><a href="?page=view_clients" class="">View Clients</a></li>
</ul>
<a href="?" class="head">Suppliers</a>
<ul>
<li><a href="?page=new_supplier" class="">New Supplier</a></li>
<li><a href="?page=view_suppliers" class="">View Suppliers</a></li>
</ul>
</div>
</div>
Thanks in advanced.