jQuery怎么让两个动画同时执行,就是两个不同的区块,在同一时间,进行不同的动画,有点儿像js折叠菜单

解决方案 »

  1.   

    都是计时器实现的,放在一起执行就行了
    $('#xx,#xx2').animate(/*配置*/);
    //如果不同动画需要拆开
    $('#xx').animate(/*配置*/);
    $('#xx2').animate(/*配置*/);
      

  2.   

    为什么我的写了动画是先后顺序执行的呀$(".boxCon a.direction").click(function(){
    $('.boxCon[selected="selected"]').animate({
    height:"48px"
    },300);
    $(this).parent(".boxCon").animate({
    height:thisHeight
    },300)
      

  3.   

    因为js 是单线程的 
    尝试下这样写 
    setTimeout(function ()
    {
        $('.boxCon[selected="selected"]').animate(
        {
            height: "48px"
        }, 300);
    }, 300);
    setTimeout(function ()
    {
        $(this).parent(".boxCon").animate(
        {
            height: thisHeight
        }, 300)}, 299);