简体   繁体   English

使用jQuery动画div并更改宽度

[英]Animate div using jQuery and changing the Width

I'm trying to slide in a div into the page while the page is loaded completely, I used CSS before, but it wasn't smooth at all, so i switched to use jQuery. 当页面完全加载时,我试图将div滑入页面中,我之前使用过CSS,但是根本不流畅,所以我改用jQuery。

It's very smooth but i have a small issue which i believe somebody with more experience could solve it very quickly. 这很顺利,但是我有一个小问题,我相信有更多经验的人可以很快解决。

If you look at my output, the effect is not very seamless and it seems it stuck at some point. 如果查看我的输出,效果不是很无缝,并且似乎停留在某个时刻。 Because i'm animating the div within change the width, i'm sure there is a better way to do that. 因为我正在为div中的div设置动画宽度,所以我确定有更好的方法可以做到这一点。

Here is my code : 这是我的代码:

$(document).ready(function() {
    $("#thumbnails").animate({
        opacity: 1,
        width: "800px",
  }, {
    duration: 500,
    specialEasing: {
    width: "linear"
    }
  });
});

Here is the Output link 这是输出链接

http://jsbin.com/cuvaxuji/1

Are you trying to slide the div ... for sliding make "#thumbnails" position absolute and write 您是否要滑动div ...,以使“ #thumbnails”位置变为绝对并写入

  $("#thumbnails").animate({
        opacity: 1,
        left: "20px",
  }

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

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