About
Explore
Events & Classes
Support Us
Join
Sign In
aigar1256@gmail.com
View Project Page
Run
Fullscreen
Untitled
HTML
CSS
JS
<!DOCTYPE HTML> <html> <head> <title>Page Title</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div class="phone"> <div id="screen" class="screen"> <div id="settingsApp" class="appData"> <h3>Change Theme</h3> <div class="themeChange" onclick="changeTheme('candy')">Switch to 'Candy' theme</div> <div class="themeChange" onclick="changeTheme('dark_sky')">Switch to 'Dark Sky' theme</div> <div class="themeChange lastChange" onclick="changeTheme('sunset')">Switch to 'Sunset' theme</div> </div> <div id="weatherApp" class="appData"> <h1 class="weatherHeading">London</h3> <h3 class="weatherTitle">Clear</h3> <h1 class="weatherNumber">26°</h1> </div> </div> <div id="dataRow" class="data row"> <img src="https://justcodaborate.com/project_images/wifi-img.png" class="wifi"> <span id="clock" class="time"></span> </div> <div id="apps" class="apps row"> <div onclick="openApp('settings')" class="app" id="settings"> <img class="app-icon" src="https://justcodaborate.com/project_images/settings-icon.png"> <span class="app-title">Settings</span> </div> <div onclick="openApp('weather')" class="app" id="weather"> <img class="app-icon" src="https://justcodaborate.com/project_images/weather-icon.png"> <span class="app-title">Weather</span> </div> </div> <div id="homeBtn" onclick="turnOn()" class="home-btn"></div> </div> </body> </html>
#settings { background: linear-gradient(to top, #7a7a7a, #595959); } #weather { background: linear-gradient(to bottom, #3579e6, #428bff); } #settings img { width: 50px; height: 50px; } #weather img { width: 50px; height: 50px; margin-left: 6px; } .app-icon { position: absolute; top: 15%; margin-left: 5px; } .appData { display: none; position: absolute; top: 6%; } #settingsApp h3 { margin-left: 10px; } .themeChange { cursor: pointer; font-weight: bold; width: 134.5%; padding: 5px; background-color: #fcfcfc; border-top: 1px solid #b5b5b5; } .lastChange { border-bottom: 1px solid #b5b5b5; } .weatherHeading { color: white; text-align: center; font-weight: 100; margin-left: 96px; } .weatherTitle { color: white; text-align: center; font-weight: 100; margin-left: 92px; } .weatherNumber { color: white; text-align: center; font-weight: 100; font-size: 50px; margin-left: 105px; } body { background-color: #a3a3a3; font-family: arial; } .phone { border: 30px solid #ca75ff; border-bottom: 55px solid #ca75ff; border-radius: 10px; width: 40%; height: 65%; position: absolute; left: 50%; transform: translate(-50%); } .screen { background-color: black; width: 100%; height: 100%; } .home-btn { position: absolute; border-radius: 50%; border: 1px solid #b76e79; left: 42%; margin-top: 5px; width: 15%; height: 9%; cursor: pointer; } .row { display: flex; flex-wrap: wrap; } .apps { display: none; top: 10%; width: 96.7%; z-index: 0; padding: 5px; position: absolute; } .data { background-color: #4d4d4d; width: 96.7%; z-index: 0; padding: 5px; position: absolute; top: 0%; display: none; } .time { color: white; text-align: center; margin-top: 5px; margin-left: 90px; } .app { width: 60px; height: 60px; border-radius: 10px; margin-right: 10px; cursor: pointer; } .app-title { color: white; position: absolute; top: 105%; } #settings { background: linear-gradient(to top, #7a7a7a, #595959); } #weather { background: linear-gradient(to bottom, #3579e6, #428bff); } #settings img { width: 50px; height: 50px; } #weather img { width: 50px; height: 50px; margin-left: 6px; } .app-icon { position: absolute; top: 15%; margin-left: 5px; } .appData { display: none; position: absolute; top: 6%; } #settingsApp h3 { margin-left: 10px; } .themeChange { cursor: pointer; font-weight: bold; width: 134.5%; padding: 5px; background-color: #fcfcfc; border-top: 1px solid #b5b5b5; } .lastChange { border-bottom: 1px solid #b5b5b5; } .weatherHeading { color: white; text-align: center; font-weight: 100; margin-left: 96px; } .weatherTitle { color: white; text-align: center; font-weight: 100; margin-left: 92px; } .weatherNumber { color: white; text-align: center; font-weight: 100; font-size: 50px; margin-left: 105px; }
function currentTime() { var date = new Date(); var hour = date.getHours(); var min = date.getMinutes(); var sec = date.getSeconds(); hour = updateTime(hour); min = updateTime(min); sec = updateTime(sec); document.getElementById("clock").innerText = hour + ":" + min; var t = setTimeout(function(){ currentTime() }, 1000); } function updateTime(k) { if (k < 10) { return "0" + k; } else { return k; } } currentTime(); var candy_theme = "linear-gradient(to bottom, #fd85ff, #ffe96b)"; var dark_sky_theme = "linear-gradient(to top, #0a003d, #000000)"; var sunset_theme = "linear-gradient(to bottom, #ffb657, #ffb8b5)"; var current_theme = "linear-gradient(to bottom, #fd85ff, #ffe96b)"; var settingsScreen = "white"; var weatherScreen = "linear-gradient(to top, #5891ed, #5b8fe3)"; var screen = document.getElementById("screen"); var homeBtn = document.getElementById("homeBtn"); var appsRow = document.getElementById("apps"); var dataRow = document.getElementById("dataRow"); var settingsApp = document.getElementById("settingsApp"); var weatherApp = document.getElementById("weatherApp"); var phoneOn = false; var phoneOff = true; var inApp = false; var homeBtnShow = false; function turnOn() { if(phoneOn==false && phoneOff==true && homeBtnShow==false) { phoneOn = true; phoneOff = false; screen.style.background = current_theme; homeBtn.setAttribute("onclick","turnOff()"); appsRow.style.display = "flex"; dataRow.style.display = "flex"; } } function turnOff() { if(phoneOn==true && phoneOff==false && homeBtnShow==false) { phoneOn = false; phoneOff = true; screen.style.background = "black"; homeBtn.setAttribute("onclick","turnOn()"); appsRow.style.display = "none"; dataRow.style.display = "none"; } } function openApp(appName) { inApp = true; homeBtnShow = true; homeBtn.setAttribute("onclick","homeScreen()"); appsRow.style.display = "none"; if(appName=="settings") { screen.style.background = settingsScreen; settingsApp.style.display = "block"; } else { screen.style.background = weatherScreen; weatherApp.style.display = "block"; } } function homeScreen() { if(inApp==true) { homeBtnShow = false; screen.style.background = current_theme; homeBtn.setAttribute("onclick","turnOff()"); appsRow.style.display = "flex"; settingsApp.style.display = "none"; weatherApp.style.display = "none"; } } function changeTheme(themeTo) { if(themeTo=="candy") { current_theme = candy_theme; } else if(themeTo=="dark_sky") { current_theme = dark_sky_theme; } else { current_theme = sunset_theme; } }