browse by category or date

This was an improvement from my previous post. We will slowly scroll the snippets using “Window.setTimeout()” functionality.

The modified code (modification is shown in bold) is as follows:


var myObject;
var myrules = {
	'.codeclicker' : {
		onclick : function() {
			var o = this.parentNode;
			if ( == 'hidden') {
				myObject = this.parentNode; = 'scroll';
				var i = 0;
				var increment = 10;
				var loopNum = 48;
				for (i=1; i<=loopNum; i++){
			else {
				myObject = this.parentNode; = '21px';
				//window.setInterval('Collapse()',50); = 'hidden';

Smaller value of increment and bigger value of loopNum will increase the smoothness. If you have better/cooler idea please share with us 🙂

GD Star Rating

About Hardono

Hi, I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

1 comment so far

Add Your Comment
  1. The drawback of this solution happen when the snippet’s height is less than 480 pixels. It will slowly scrolled until 480 pixels then reduced back to its maximum size.

    If only we could know how many pixels the height is instead of 100% we might be able to enhance it.