Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wenjie Fang - JS-digit-clock - Octos #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 4 additions & 15 deletions index.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
body {
background-color: #80d4ea;
}

#clock {
height: 100px;
width: 800px;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
padding-top: 70px;
font-family: courier, monospace;
text-align: center;
color: white;
font-size: 100px;
}
background: linear-gradient(rgb(202, 233, 190), rgb(4, 136, 38));
height: 1000px;
font-size: 2rem;
};
40 changes: 29 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>Clock Tower</title>
<meta charset="utf-8">
<link href="index.css" media="screen" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id='clock'></div>
</body>
</html>
<head>
<title>Clock Tower</title>
<meta charset="utf-8">
<link href="index.css" media="screen" rel="stylesheet" type="text/css"/>
</head>

<body>
<header>
<h1>World Clock</h1>
<h5>Click city to see local time</h5>
</header>
<ul id="city-list">
<li id="seattle">Seattle</li>
<div id="seattle-clock"></div>
<li id="london">London</li>
<div id="london-clock"></div>
<li id="beijing">Beijing</li>

<div id="beijing-clock"></div>

<script src="index.js"></script>
</ul>


<script
src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
<script src="index.js"></script>
</body>
</html>
37 changes: 36 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
// Your code here
// // Your code here

const timeBuilder = () => {
let newDate = new Date();
let date = newDate.toString();
$('#seattle-clock').html(date);
};

const londonTime = () => {
let newDate = new Date();
let date = newDate.toUTCString();

$('#london-clock').html(date);
};

const beijingTime = () => {
let date = new Date();
let newDate = new Date(date.getTime() + (date.getTimezoneOffset() * 128570 ));

$('#beijing-clock').html(newDate);
};


$(document).ready( () => {
$('#seattle').click( () => {
setInterval(timeBuilder, 1000);
});

$('#london').click( () => {
setInterval(londonTime, 1000);
})

$('#beijing').click( () => {
setInterval(beijingTime, 1000);
})
})
9 changes: 9 additions & 0 deletions node_modules/moment-timezone/.idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions node_modules/moment-timezone/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions node_modules/moment-timezone/.idea/moment-timezone.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions node_modules/moment-timezone/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading