About
Explore
Events & Classes
Support Us
Join
Sign In
codeOrRetreat
View Project Page
Run
Fullscreen
Donut cliker | Fork
HTML
CSS
JS
<!-- Your new project - here it is! Create something awesome with the JUSTCodaborate code editor! Created by zaydor, subject to copyright. --> <!DOCTYPE HTML> <html> <head> <title>Page Title</title> <meta charset="utf-8"> <meta name="author" content="zaydor"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <a class="open-modal" href="#modal">Instructions</a> <p>Clicks: <span>0</span></p> <p>Level: <span>1</span></p> <div onclick="resetClicks()" class="reset">reset</div> <br> <div onclick="clicked()" class="donut"> <div class="donut-icing"> you option </div> </div> <div id="modal" class="modal"> <div class="modal-dialog"> <div class="modal-content"> <header class="container"> <a href="#" class="closebtn">×</a> <h2>Instructions</h2> </header> <div class="container"> <p>Click the donut to earn clicks and level up.</p> <p>To get to level 2 you need to earn: 100 clicks</p> <p>To get to level 3 you need to earn: 500 yeah yeah yeah s</p> </div> </div> </div> </div> </body> </html>
body { justify-content: center; align-items: center; font-family: "montserrat", arial; user-select: none; } .donut { border: 80px #f5ff70 solid; width: 200px; height: 200px; cursor: pointer; border-radius: 50%; justify-content: center; align-items: center; display: block; margin: auto; } .donut-icing { width: 100px; height: 100px; border-radius: 50%; margin: auto; position: relative; left: -40px; top: -40px; display: block; border: 90px #ff9efa solid; } .reset { color: red; border: 10px solid red; text-transform: uppercase; display: block; width: 54px; margin: auto; padding: 5px; border-radius: 5px; cursor: pointer; } p { text-align: center; } @keyframes example { from {top:-100px;opacity: 0;} to {top:0px;opacity:1;} } .modal { display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0.4); } .modal:target { display: table; position: absolute; } .modal-dialog { display: table-cell; vertical-align: middle; } .modal-dialog .modal-content { margin: auto; background-color: #f3f3f3; position: relative; padding: 0; outline: 0; border: 1px #777 solid; text-align: justify; width: 80%; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); -webkit-animation-name: example; -webkit-animation-duration: 0.5s; animation-name: example; animation-duration: 0.5s; } .closebtn { text-decoration: none; float: right; font-size: 35px; font-weight: bold; color: #fff; } .closebtn:hover, .closebtn:focus { color: #000; text-decoration: none; cursor: pointer; } .container { padding: 2px 16px; } header { background-color: #5cb85c; font-size: 25px; color: white; } .open-modal { color: white; background-color: green; text-decoration: none; padding: 5px; display: block; width: 81px; margin: auto; }
var donut_icing = document.querySelector(".donut-icing"); var para1 = document.getElementsByTagName("span")[0]; var para2 = document.getElementsByTagName("span")[1]; var mode1 = "red"; var mode2 = "lavenderblush"; var mode3 = "#db88aa"; var score = 0; var level = 1; var click = new Audio('https://justcodaborate.com/project_images/click.wav'); var level2 = new Audio('https://justcodaborate.com/project_images/clap.wav'); function resetClicks() { score = 0; level = 1; donut_icing.style.border = "90px solid "+mode1; para1.innerHTML = "0"; para2.innerHTML = "1"; } function clicked() { score++; click.play(); para1.innerHTML = score; if(level==3 && score==200) { donut_icing.style.border = "90px solid "+mode3; level3.play(); para1.innerHTML = score; para2.innerHTML = level; } else if(level==3 && score>200) { donut_icing.style.border = "90px solid "+mode3; para1.innerHTML = score; para2.innerHTML = level; } else if(level==2 && score>=100) { donut_icing.style.border = "90px solid "+mode2; level2.play(); para1.innerHTML = score; para2.innerHTML = level; level++; } else if(level==1 && score<100) { donut_icing.style.border = "90px solid "+mode1; para1.innerHTML = score; para2.innerHTML = level; level++; } else { score++; click.play(); para1.innerHTML = score; } }