Return to Snippet

Revision: 19857
at November 2, 2009 10:34 by AzizLight


Initial Code
$(function(){

	var speed = 1000;
	var speedup = 200;
	var pos = [];
	var pos_count = 6;

	$('#preload img').ready(function(){
		$('#wait').hide();
		(function(){
			var tm = new Date();
			setto(tm.getHours()*10000+tm.getMinutes()*100+tm.getSeconds());
			setTimeout(arguments.callee,speed);
		})()
	});
	
	function setto(to){
		for ( var j=0; j<pos_count; j++){
			var postmp = (j) ? Math.floor(to/Math.pow(10,j))%10 : to%10;
			if ( pos[j] != postmp ){
				pos[j] = postmp;
				plus(pos[j],j+1);
			}
		}
	}

	function plus (to,pos){
		var pos_dn = $('.dn .p'+pos);
		var i_to = $('<img>');
			i_to.attr('src','images/dn'+to+'.png');
		var i_from = $('img',pos_dn);
			i_from.attr('width',120);
		pos_dn.prepend(i_to);
		i_from.animate({height:10},speedup,function(){
			var pos_dn = $('.dn .p'+pos);
			$('img',pos_dn).eq(1).remove();
	
			var pos_up = $('.up .p'+pos);
			var i_to = $('<img>');
				i_to.attr('src','images/up'+to+'.png');
				i_to.attr('width',120);
				i_to.attr('height',10);
			var i_from = $('img',pos_up);
			pos_up.append(i_to);
			i_to.animate({height:100},speedup, function(){
				var pos_up = $('.up .p'+pos);
				$('img',pos_up).eq(0).remove();
			})
		});
	}

})

Initial URL
http://iyoremo.com/jquery-sexy-clock/

Initial Description
(I am not the author of this script. I suppose the homepage of the author is the following: [http://iyoremo.com/](http://iyoremo.com/))

Initial Title
jQuery Sexy Clock

Initial Tags
jquery

Initial Language
jQuery