losing variable in function
<p>Could someone tell me why in the first <code>alert(items.index($(this))) = 1</code> and the second <code>alert(items.index($(this))) = -1</code>. How does this value get changed within the other function?</p>

<pre><code>$(function () {
var items = $('#v-nav&gt;ul&gt;li').each(function () {
    $(this).click(function () {
        //remove previous class and add it to clicked tab
        items.removeClass('current');
        $(this).addClass('current');

        alert(items.index($(this)));

        $('#v-nav&gt;div.tab-content').fadeOut("slow", function () { 
        alert(items.index($(this)));
        $('#v-nav&gt;div.tab-content').eq(items.index($(this))).fadeIn("slow");
        });


      //  window.location.hash = $(this).attr('tab');
    });
});
</code></pre>
