简体   繁体   English

用jQuery动画div

[英]animate div with jquery

HTML HTML

<div id="ModeliSadrzajAir">
  <div class="kocka220x300">

  </div>
  <div class="kocka220x300">

  </div>
  <div class="kocka220x300">

  </div>
  <div class="kocka220x300">

  </div>
</div>

I have 5 divs and they have css 我有5个div,他们有CSS

#ModeliSadrzajAir
{
    width: 960px;
    margin: -60px 0px 30px -10px;
    min-height: 500px;
    z-index: 70;
    position: relative;
}

.kocka220x300
{
    border-radius: 5px;
    width: 220px;
    margin: 10px;
    height: 300px;
    float: left;
    -webkit-transition: all 0.4s ease-out;
    -moz-transition: all 0.4s ease-out;
    -ms-transition: all 0.4s ease-out;
    -o-transition: all 0.4s ease-out;
    transition: all 0.4s ease-out;
}

If I transform first div width, last div goes down as expected but it doesn't have animation. 如果我转换第一个div宽度,则最后一个div会按预期下降,但没有动画。 How can I put animation on the other divs? 如何在其他div上放置动画?

I have example on link http://jsfiddle.net/hrvojeBarbaric/Xsjdh/1/ 我在链接http://jsfiddle.net/hrvojeBarbaric/Xsjdh/1/上有示例

Based on a bit of research I don't think this is possible without more extensive JavaScript. 根据一些研究,如果没有更广泛的JavaScript,我认为这是不可能的。 In essence you have to position the elements "absolute" then determine based on the new width/height of the first element, where the other elements belong. 本质上,您必须将元素定位为“绝对”,然后根据第一个元素的新宽度/高度确定其他元素所属的位置。 Finally, if you put this into another div you can make sure the height and width of that div moves other elements down on the page. 最后,如果将其放入另一个div,则可以确保该div的高度和宽度将页面上的其他元素向下移动。

There are a few helper libraries that may do this for you. 有一些帮助程序库可以为您完成此操作。 For example: 例如:

Hopefully this will put you on the right track. 希望这将使您走上正确的道路。 Best of luck! 祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM