jQuery性感时钟
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jQuery性感时钟相关的知识,希望对你有一定的参考价值。
(I am not the author of this script. I suppose the homepage of the author is the following: [http://iyoremo.com/](http://iyoremo.com/))
$(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(); }) }); } })
以上是关于jQuery性感时钟的主要内容,如果未能解决你的问题,请参考以下文章
[12小时Javascript Clock显示24时间,错误的AM / PM
Visual Studio 2012-2019的130多个jQuery代码片段。
markdown 在WordPress中使用jQuery代码片段