superdooper
02-06-2009, 01:45 PM
Hi all,
I am trying to create a Twitter-esque navigation (https://twitter.com/about)
I have the following code:
<script language="javascript">
$(document).ready(function() {
$('[class^=toggle-item]').hide();
$('[class^=link]').click(function() {
var $this = $(this);
var x = $this.attr("className");
$('.toggle-item-' + x).slideDown('normal')
.siblings('div:visible').slideUp('normal');
return false;
});
});
</script>
Which hides all divs with toggle-item-link(NUMHERE) in the class.
It shows/hides all the Divs perfectly. Click a LINK1 it opens link1 and closes all others, click link3 it opens link3 and closes all the others etc etc.
I was wondering if anyone could help me modify it so it displays toggle-item-link1 by default (ie on page load) and then when another link is clicked it closes link1 for the required link?
TIA
James
I am trying to create a Twitter-esque navigation (https://twitter.com/about)
I have the following code:
<script language="javascript">
$(document).ready(function() {
$('[class^=toggle-item]').hide();
$('[class^=link]').click(function() {
var $this = $(this);
var x = $this.attr("className");
$('.toggle-item-' + x).slideDown('normal')
.siblings('div:visible').slideUp('normal');
return false;
});
});
</script>
Which hides all divs with toggle-item-link(NUMHERE) in the class.
It shows/hides all the Divs perfectly. Click a LINK1 it opens link1 and closes all others, click link3 it opens link3 and closes all the others etc etc.
I was wondering if anyone could help me modify it so it displays toggle-item-link1 by default (ie on page load) and then when another link is clicked it closes link1 for the required link?
TIA
James
