views:

98

answers:

1

I really like the way Reddit's comment system works - particulary the ability to smoothly fold/unfold a tree of comments.

Is there some standard JavaScript code/library that does this? Or did Reddit develop this inhouse and is not portable?

I'm fairly a beginner in JS, so browsing through Reddit's page source is not that helpful.

A: 

You can do it in a dozen lines of pure JavaScript, but jQuery has convenient slideUp() and slideDown function that do that in a line or two.

Max Shawabkeh
Perhaps I'll give it a try. I've looked briefly at jquery before, but haven't tried animations with it. I presume slideUp and slideDown can be set so as _not_ to actually slide, but "jump" instead? Actually animating a slide would be quite CPU intensive...
Beetle B.
Sure, you can make stuff pop instead of animate, but with today's hardware and JS engines, a simple sliding animation is not a problem at all. There're live examples on the pages I linked.
Max Shawabkeh