为什么我的回调函数jQuery slow()不起作用?

问题描述:

这是我的代码:为什么我的回调函数jQuery slow()不起作用?

$(document).ready(function() { 
      posicionarBarraIdioma(); //This function aligns my div #barraIdioma at the bottom of the other div. 

      $('#barraProgreso').progressbar({ value: 1 }); 

      $('#barraIdioma').show('fast',animarBarraProgreso); 

     }); 

     function animarBarraProgreso() { 
      $('.ui-progressbar-value').animate({width: 100 + '%'},1250, mostrarIdiomas); 
     }  

     function mostrarIdiomas() { 
      $('#barraProgreso').fadeOut(function() { 
       $('#barraIdioma a').each(function(index, element){$(element).show()}) 
      }); 
     } 

我需要在div #barraIdioma放入位置,然后变得可见,然后动画时...但是,当格显示出来,动画已经运行。我究竟做错了什么?


解决!我意外地在CSS上隐藏了进度条和其他div。

+0

它仍然动画时,它不是在回调.show? – Fresheyeball 2012-04-03 03:12:37

+0

我试图在显示效果后使用延迟或setTimeout,但它始终是相同的结果。 我可以看到动画的唯一方法不是隐藏div(而不是使用show) – schaable 2012-04-03 15:08:07

+0

你可以为此制作一个js小提琴吗? – Fresheyeball 2012-04-03 15:24:06

我认为你的JavaScript很好。我用你发布的内容创建了一个JSFiddle,我相信它的行为与你描述的一样。也许问题在别处。你能发布你的HTML吗?

我发现的唯一错误是,你缺少的分号:

function mostrarIdiomas() { 
     $('#barraProgreso').fadeOut(function() { 
      $('#barraIdioma a').each(function(index, element) { 
       $(element).show(); //<-- missing semicolon here 
      }); //<-- missing semicolon here 
     }); 
    } 
+0

用我的完整代码更新! – schaable 2012-04-03 15:01:11