I've been looking for something very simple: How to make a side navigation expand with animation on page load, but all the tutorial websites I usually go to don't seem to have it.
The closest I could find is this jQuery sample: http://codeblitz.wordpress.com/2009/04/15/jquery-animated-collapsible-list/
I've managed to strip down the list like so:
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(function(){
$('li')
.css('pointer','default')
.css('list-style','none');
$('li:has(ul)')
.click(function(event){
if (this == event.target) {
$(this).css('list-style',
(!$(this).children().is(':hidden')) ? 'none' : 'none');
$(this).children().toggle('slow');
}
return false;
})
.css({cursor:'pointer', 'list-style':'none'})
.children().hide();
$('li:not(:has(ul))').css({cursor:'default', 'list-style':'none'});
});
<body>
<fieldset>
<legend>Collapsable List Demo</legend>
<ul>
<li>A - F</li>
<li>G - M
<ul>
<li>George Kent Technology Centre</li>
<li>Hampshire Park</li>
<li>George Kent Technology Centre</li>
<li>Hampshire Park</li>
</ul>
</li>
<li>
N - R
</li>
<li>S - Z</li>
</ul>
</fieldset>
My question is:
Is there any way to make this list expand on page load instead of on click? I also don't need it to collapse at all; basically I need only the animating expansion.
Thank you for your time and advice. :)