有人可以告诉我为什么在第一个alert(items.index($(this))) = 1和第二个alert(items.index($(this))) = -1。这个值是如何在另一个函数中改变的?
$(function () {
var items = $('#v-nav>ul>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>div.tab-content').fadeOut("slow", function () { 
        alert(items.index($(this)));
        $('#v-nav>div.tab-content').eq(items.index($(this))).fadeIn("slow");
        });
      //  window.location.hash = $(this).attr('tab');
    });
});