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

Phoebe - Ampers #41

Open
wants to merge 1 commit 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions index.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
body {
background-color: #80d4ea;
.color {
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;
.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;
}

#color-button {
background-color: darkblue;
border-color: darkblue;
color: white;
}

.new-color {
color: darkblue;
}
7 changes: 5 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
<link href="index.css" media="screen" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id='clock'></div>
<body class="color">
<div class='clock'></div>
<button id="color-button">Color</button>
<button id="time-button">24-12hr</button>
</body>
</html>

<script src="jquery-3.3.1.js" type="text/javascript"></script>
<script src="index.js"></script>
22 changes: 21 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
// Your code here
$(document).ready( function (){

let militaryTime = true;

$('#time-button').on('click', function(){
militaryTime = !militaryTime;
});

$('#color-button').on('click', function(){
$('div').toggleClass('new-color');
});

setInterval( function(){ timeFn() }, 1000 );

function timeFn() {
let date = new Date();
let time = date.toLocaleTimeString('en-US', { hour12: militaryTime });
$('.clock').text(time);
}

});
Loading