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

时间:2012-04-02 23:39:18

标签: jquery jquery-animate

这是我的代码:

$(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放置位置,然后变为可见然后动画发生......但是当div出现时,动画已经运行。我做错了什么?


解决!我无意中将进度条与我的CSS上的另一个div一起隐藏。

1 个答案:

答案 0 :(得分:1)

我认为您的JavaScript很好。我使用您发布的内容创建了JSFiddle,我相信它的行为与您描述的方式相同。也许问题出在其他地方。你可以发布你的HTML吗?

我注意到的唯一错误是,你丢失了分号:

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