【问题标题】:How to animate multiple effects at same time using jQuery?如何使用 jQuery 同时为多个效果设置动画?
【发布时间】:2010-08-28 07:23:04
【问题描述】:

我正在使用 jQuery 的 animate() 函数为 div 设置动画。当我给出多个效果(如高度 140 和宽度 200)时,下一个效果只有在前一个效果完成后才会开始。我想同时执行。任何帮助将不胜感激。

$(document).ready(function(){
    $(".gal_item").hover(function(){                    
        $(this).children().animate({height:110},"medium");
        $(this).children().animate({width:110},"medium");
    });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="gal_item"><img src="images/2.jpg" width="120" height="100" /></div>
<div class="gal_item"><img src="images/3.jpg" width="120" height="100" /></div>

【问题讨论】:

  • 请发布您的代码。你应该可以这样做: $('#id').animate({width:200px,height:140px},slow)
  • 我添加了代码!。请检查

标签: php javascript jquery css effects


【解决方案1】:

animate 方法接受多种样式声明,你可以简单...

$(document).ready(function(){
    $(".gal_item").hover(function(){                    
        $(this).children().animate({
            height:110,
            width: 110
        }, "medium");
    });
});

【讨论】:

  • 感谢伙伴!,完美的工作!,+1 和一个滴答声。
猜你喜欢
  • 1970-01-01
  • 2013-06-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-17
  • 1970-01-01
相关资源
最近更新 更多