jQuery超酷平面式時(shí)鐘效果代碼分享
本文實(shí)例講述了jQuery超酷平面式時(shí)鐘效果代碼。分享給大家供大家參考,具體如下:
jQuery制作的超酷平面式時(shí)鐘效果,把日期和時(shí)間通過橫向刻度條展現(xiàn),經(jīng)測試效果非常酷,是一個(gè)很不錯(cuò)的學(xué)習(xí)實(shí)例。
這里我們還要提到之前實(shí)現(xiàn)的另一個(gè)特別新穎的時(shí)間顯示樣式:js實(shí)現(xiàn)溫度計(jì)時(shí)間樣式,兩者都完全突破了傳統(tǒng)的時(shí)鐘概念,感興趣的各位可不要錯(cuò)過了哈。
運(yùn)行效果圖:----------------------查看效果 下載源碼-----------------------
小提示:瀏覽器中如果不能正常運(yùn)行,可以嘗試切換瀏覽模式。
為大家分享的jQuery超酷平面式時(shí)鐘效果代碼如下
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="JS代碼,時(shí)鐘,日期,刻度條,jQuery" /> <meta name="description" content="jQuery制作的超酷平面式時(shí)鐘效果,更多時(shí)鐘,日期,刻度條,jQuery請?jiān)L問腳本之家JS代碼頻道。" /> <title>jQuery制作的超酷平面式時(shí)鐘效果_腳本之家</title> <style type="text/css"> body { background:#bae1ea url(back.jpg) 50% 0px no-repeat; color:#000; } /* container for clock */ #wrap { position:relative; margin: 100px auto 0; width:700px; height:440px; background:url("slider clock(trans).png") no-repeat top left; border-style:solid; border-width:1px; overflow:hidden; } /* style background and size of all sliding divs */ #wrap div { position:absolute; margin-left:-700px; width:1400px; height:40px; background:url("slider clock(trans).png") repeat-x; } /* specific position and background position for sliding divs */ #wrap #day { top:40px; background-position:0 -440px; } #wrap #month { top:120px; background-position:0 -480px; } #wrap #date { top:200px; background-position:0 -520px; } #wrap #hour { top:280px; background-position:0 -560px; } #wrap #min { top:320px; background-position:0 -600px; } #wrap #sec { top:400px; background-position:0 -640px; } #title { margin:20px auto; width:550px; text-align:center; } #other { margin:10px auto; width:550px; text-align:center; } </style> <script type="text/javascript" src="jquery.js"> </script> <script> $(document).ready(function(){ function checktime(olddel){ var now = new Date(); var nowdel = now.getDay() + "|" + now.getMonth() + "|" + now.getDate() + "|" + now.getHours() + "|" + now.getMinutes() + "|" + now.getSeconds(); if ( olddel != nowdel ) { var oldsplit = olddel.split("|"); var nowsplit = nowdel.split("|"); if ( oldsplit[5] != nowsplit[5] ) { clock_slide('#sec',nowsplit[5],11); if ( oldsplit[4] != nowsplit[4] ) { clock_slide('#min',nowsplit[4],11); if ( oldsplit[3] != nowsplit[3] ) { clock_slide('#hour',nowsplit[3],28); if ( oldsplit[2] != nowsplit[2] ) { clock_slide('#day',nowsplit[0],100); clock_slide('#date',(nowsplit[2]-1),22); if ( oldsplit[1] != nowsplit[1] ) { clock_slide('#month',nowsplit[1],57); }; }; }; }; }; }; function clock_slide(which,howmuch,multiple){ $(which).stop().animate({marginLeft: ((howmuch*multiple)-700)+'px'}, 250, 'linear'); }; setTimeout(function(){checktime(nowdel);}, 250); }; checktime("0|0|0|0|0|0"); }); </script> </head> <body> <div id="wrap"> <div id="day"> </div> <div id="month"> </div> <div id="date"> </div> <div id="hour"> </div> <div id="min"> </div> <div id="sec"> </div> </div> <!-- End "wrap" --> <div style="text-align:center;clear:both"> <p>來源:<a href="http://www.dbjr.com.cn" target="_blank">vonholdt</a> 代碼整理:<a href="http://www.dbjr.com.cn" target="_blank">腳本之家</a> 感謝:<a href="http://www.dbjr.com.cn" target="_blank">liulisuo</a></p> <p>轉(zhuǎn)載請注明出處,此代碼僅供學(xué)習(xí)交流,請勿用于商業(yè)用途。</p> </div> </body> </html>
更多JavaScript時(shí)鐘特效點(diǎn)擊查看:JavaScript時(shí)鐘特效專題
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- jquery+html5時(shí)鐘特效代碼分享(可設(shè)置鬧鐘并且語音提醒)
- jquery+html5制作超酷的圓盤時(shí)鐘表
- jQuery+css實(shí)現(xiàn)的時(shí)鐘效果(兼容各瀏覽器)
- jquery制作LED 時(shí)鐘特效
- jquery制作圖片時(shí)鐘特效
- jquery模擬LCD 時(shí)鐘的html文件源代碼
- 基于jQuery和CSS3制作數(shù)字時(shí)鐘附源碼下載(jquery篇)
- jQuery CSS3相結(jié)合實(shí)現(xiàn)時(shí)鐘插件
- 基于Jquery和CSS3制作數(shù)字時(shí)鐘附源碼下載(CSS3篇)
- jQuery實(shí)現(xiàn)的電子時(shí)鐘效果完整示例
相關(guān)文章
jquery動(dòng)態(tài)分頁效果堪比時(shí)光網(wǎng)
剛剛弄好了一個(gè)jquery動(dòng)態(tài)分頁效果,拿出來與大家分享,效果與時(shí)光網(wǎng)的差不多2014-09-09基于jquery css3實(shí)現(xiàn)點(diǎn)擊動(dòng)畫彈出表單源碼特效
這篇文章主要介紹了基于jquery css3實(shí)現(xiàn)點(diǎn)擊動(dòng)畫彈出表單,彈出的表單沒有任何遮蓋層,在web前端程序開發(fā)中經(jīng)常會(huì)用到,需要的朋友可以參考下2015-08-08jQuery內(nèi)容選擇器與表單選擇器實(shí)例分析
這篇文章主要介紹了jQuery內(nèi)容選擇器與表單選擇器,結(jié)合實(shí)例形式分析了jQuery內(nèi)容選擇器與表單選擇器的功能、用法及相關(guān)操作注意事項(xiàng),需要的朋友可以參考下2019-06-06正則驗(yàn)證小數(shù)點(diǎn)后面只能有兩位數(shù)的方法
下面小編就為大家?guī)硪黄齽t驗(yàn)證小數(shù)點(diǎn)后面只能有兩位數(shù)的方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-02-02jquery 簡短幾句代碼實(shí)現(xiàn)給元素動(dòng)態(tài)添加及獲取提示信息
雖然是很基本的東西,但為什么很基本的方法就可以實(shí)現(xiàn)的東西有些人偏偏還要去追求復(fù)雜高深難懂的呢?這里只是交流而已2011-09-09