diff --git a/index.html b/index.html index c1129f7..8f3a19a 100644 --- a/index.html +++ b/index.html @@ -3,12 +3,12 @@ - i ♥ js + I ♥ JS -

Stop Watch

+

Stop Watch

diff --git a/style.css b/style.css index 6ddb643..b5eb02f 100644 --- a/style.css +++ b/style.css @@ -4,6 +4,14 @@ margin: 50px; text-align: center; } +#stopwatch { + text-align: center; + font-size: 60px; +} +#timer { + text-align: center; + font-size: 55px; +} h1 { font-family: Josefin Slab; @@ -27,4 +35,3 @@ button { button:hover{ background: #356094; } - diff --git a/timers.js b/timers.js index fd40910..c833425 100644 --- a/timers.js +++ b/timers.js @@ -1,4 +1,29 @@ +window.onload = function() { + console.log("setup"); + var timer = document.getElementById('timer'), + reset = document.getElementById('reset'), + start = document.getElementById('start'), + pause = document.getElementById('pause'), + seconds = 0; + /* setInterval function */ + start.onclick = function() { + var seconds = window.setInterval(function() { updateTime() }, 1000); + function updateTime() { + seconds++; + $('#timer').text("Time Elapsed: " + seconds); + } + $('#timer').innerHTML(seconds); + } + pause.onclick = function pauseTime() { + window.clearInterval(seconds); + $('#pause').on('click', pauseTime); + } + reset.onclick = function() { + + } + +};