List doesn't want to toggle
<p>I have a (semantically incorrect) HTML like this:</p>

<pre><code>&lt;ul&gt;
&lt;li class="year"&gt;2009&lt;/li&gt;
&lt;li&gt;&lt;a href="project1.html"&gt;Project 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="project2.html"&gt;Project 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="project3.html"&gt;Project 3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li class="year"&gt;2008&lt;/li&gt;
&lt;li&gt;&lt;a href="project4.html"&gt;Project 4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="project5.html"&gt;Project 5&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="project6.html"&gt;Project 6&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li class="year"&gt;2007&lt;/li&gt;
&lt;li&gt;&lt;a href="project7.html"&gt;Project 7&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="project8.html"&gt;Project 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="project9.html"&gt;Project 9&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>and a jQuery script like this:</p>

<pre><code>$(function() {
    $('.year').click(function() {
     $('ul').find('li:not(.year)').slideUp('fast');
     $(this).closest('ul').find('li:not(.year)').toggle('fast');
    })
})
</code></pre>

<p>It works almost as needed. By default all <code>ul li</code>-s are hidden except those having the class year. When the user clicks on a year, any opened year's links slide up and the clicked year's links slide down. The problem is that if I click on a year when it's opened it first slides up (being intercepted by the first line) and then slides down via the toggle line. I'd like it to stay closed with the slide up line not intercepting the currently clicked year.</p>

<p>Hope this makes sense.</p>

<p>Any help appreciated.</p>
