javascript - How to foldunfold a DIV like on this website - Stack Overflow

I really like the way the DIVs foldunfold from the top to the bottom then left to right when users cli

I really like the way the DIVs fold/unfold from the top to the bottom then left to right when users click on the menu items (about, services, my tools, etc) on this website. Seems that it has been developed by a very talented person.

Any idea how to achieve something like that? I was expecting this to be done via plex CSS animation, but looking at the CSS sheet that doesn't seem to be the case.

Many thank

I really like the way the DIVs fold/unfold from the top to the bottom then left to right when users click on the menu items (about, services, my tools, etc) on this website. Seems that it has been developed by a very talented person.

Any idea how to achieve something like that? I was expecting this to be done via plex CSS animation, but looking at the CSS sheet that doesn't seem to be the case.

Many thank

Share Improve this question edited Dec 15, 2014 at 20:31 Greg asked Dec 2, 2014 at 19:59 GregGreg 3,06313 gold badges61 silver badges107 bronze badges 2
  • 2 You can view the CSS and HTML and JS on the site... why not just view it there? – Codeman Commented Dec 2, 2014 at 20:01
  • It looks like they have the div positioned with a border and are simply changing the width/height over time. – rfornal Commented Dec 2, 2014 at 20:05
Add a ment  | 

3 Answers 3

Reset to default 3

On that site it is achieved with the use of jQuery UI - more specifically with the Fold Effect.

I think using jQuery UI for this task alone would be an overkill, in fact you don't even need jQuery here, but I think you want to stick to it, since it's relatively easy both to read and to write code:

$("a").click(function() {
    $("#fold")
    .animate({ width: "500px" }, 1000 )
    .animate({ height: "500px" }, 1000 )
});

See:

http://jsfiddle/bartkarp/u3qtt6fo/

http://api.jquery./animate/

If you don't want to use jQuery UI, I guess you could do it by animating the css...:-?? First state is height: 0; and width :30px; ...then using the animate on click event you could give the height a value and animation time, the width a delay equal o bigger than the height animation time and then it's value...that should do the trick but it's more stiff than actually using the UI

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743959913a4536487.html

相关推荐

  • javascript - How to foldunfold a DIV like on this website - Stack Overflow

    I really like the way the DIVs foldunfold from the top to the bottom then left to right when users cli

    2天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信