JS simple picture version clock with flip effect

Source: Internet
Author: User

js simple picture version clock with flip effect

<! DOCTYPE html>

<meta charset= "UTF-8" >

<title> clocks </title>

<style type= "Text/css" >

ul,li{

List-style:none;

margin:0;

padding:0;

}

ul{

Position:absolute;

left:260px;

top:50%;

Margin-top: -18px;

}

Ul:nth-of-type (2) {

left:426px;

}

li{

width:16px;

height:16px;

border-radius:50%;

margin-bottom:6px;

Background:url (http://cdn.attach.qdfuns.com/notes/pics/201701/05/202930mgugifcg7sqssd3z.png);

}

. box {

Background:url (http://cdn.attach.qdfuns.com/notes/pics/201701/05/203841jh2r8ehe3htb2h8h.jpg);

width:1024px;

height:701px;

margin:0 Auto;

position:relative;

}

. Clock {

width:625px;

height:116px;

Background:url (http://cdn.attach.qdfuns.com/notes/pics/201701/05/204156a2xxddle694ep626.png);

Position:absolute;

top:50%;

left:50%;

Margin-top: -58px;

Margin-left: -312px;

}

. Clockico {

margin-top:26px;

margin-left:26px;

Float:left;

}

. numclock {

margin-left:30px;

margin-top:18px;

Overflow:hidden;

Float:right;

}

. Numclock Div {

margin-right:40px;

Float:left;

}

. Numclock span {

width:60px;

height:76px;

Display:inline-block;

Background:black;

border:1px solid white;

Font:bolder 40px/76px blackbody ;

Color:white;

Text-align:center;

}

. Dong {

Animation:run 700ms linear;

}

@-webkit-keyframes Run {

from {

Transform:rotatex (0DEG);

}

to {

Transform:rotatex (360DEG);

}

}

. hidden{

Display:none;

}

.

</style>

<body>

<div class= "box" >

<div class= "Clock" >

<div class= "Numclock" >

<div class= "Hour" >

<span>1</span>

<span>1</span>

</div>

<ul>

<li></li>

<li></li>

</ul>

<div class= "Minute" >

<span>1</span>

<span>1</span>

</div>

<ul>

<li></li>

<li></li>

</ul>

<div class= "Second" >

<span>1</span>

<span class= "Miao" >1</span>

</div>

</div>

</div>

</div>

<script type= "Text/javascript" >

var UlS = Document.queryselectorall (' ul ');

var HourS = Document.queryselector (". Numclock"). Queryselectorall ("span") [0];

var Hourg = Document.queryselector (". Numclock"). Queryselectorall ("span") [1];

var MinuteS = Document.queryselector (". Numclock"). Queryselectorall ("span") [2];

var Minuteg = Document.queryselector (". Numclock"). Queryselectorall ("span") [3];

var SecondS = Document.queryselector (". Numclock"). Queryselectorall ("span") [4];

var secondg = Document.queryselector (". Numclock"). Queryselectorall ("span") [5];

Clock ();

Turn on Timer

SetInterval (clock, 1000);

function Clock () {

var date = new Date ();

Get hours //////////////////////////////////

var hour = date.gethours ();

gets the 10 digits of the hour

Hour/10

hours.innerhtml = parseint (HOUR/10);

get the single digit of the hour

Hour%10

hourg.innerhtml = parseint (hour% 10);

get minutes //////////////////////////////////

var minute = Date.getminutes ();

Console.log (minute);

gets the 10 digits of the minute

Minute/10

minutes.innerhtml = parseint (MINUTE/10);

gets the single digit of the minute

Minute%10

minuteg.innerhtml = parseint (minute% 10);

get seconds //////////////////////////////////

var second = Date.getseconds ();

Console.log (second);

gets the 10 digits of the second

Second/10

seconds.innerhtml = parseint (SECOND/10);

gets the single digit of the second

Second%10

secondg.innerhtml = parseint (second% 10);

}

var onOff = true;

SetInterval (function () {

if (ONOFF) {

Secondg.classname = "Dong";

Uls[0].classname = ' hidden '

Uls[1].classname = ' hidden '

OnOff = false;

} else {

Secondg.classname = "";

Uls[0].classname = ' '

Uls[1].classname = ' '

OnOff = true;

}

}, 1000)

</script>

</body>

   

A new web front-end learning Group, 120342833 , welcome everyone to study together, before in the Web Learning group saw added.

JS simple picture Edition clock with flip effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.