FCC: Calculator
How do I make an fcc: calculator?
What is a fcc: calculator? How do you make a fcc: calculator? This script and codes were developed by Jeanine on 12 September 2022, Monday.
FCC: Calculator - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>FCC: Calculator</title> <link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Share+Tech+Mono'>
<link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Zeyada'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="bg"> <div class="wrapper"> <div class="calc-body"> <div class="calc-output"> <div class="output"> <div class="outputtext">0</div> <div class="log"></div> </div> </div> <div class="calc-buttons"> <ul> <li class="delete">AC</li> <li class="math">÷</li> <li>7</li> <li>8</li> <li>9</li> <li class="math">×</li> <li>4</li> <li>5</li> <li>6</li> <li class="math">-</li> <li>1</li> <li>2</li> <li>3</li> <li class="math">+</li> <li>0</li> <li>.</li> <li class="sum">=</li> </ul> <div class="clear"></div> </div> </div> <p class="credits"> <a target="_blank" href='//satinflame.com'>Design & Development by satinflame design</a> </p> </div>
</div> <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
FCC: Calculator - Script Codes CSS Codes
* { box-sizing: border-box;
}
.wrapper { max-width: 480px; margin: 0 auto;
}
html,
body { font-family: 'Share Tech Mono', Arial; margin: 0; padding: 0; height: 100%; display: block; /* disable selection */ -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; user-select: none; /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#a71068+0,a71068+29,e5632b+69,f19d2d+99 */ background: #a71068; /* Old browsers */ background: -moz-linear-gradient(-45deg, #a71068 0%, #a71068 29%, #e5632b 69%, #f19d2d 99%); /* FF3.6-15 */ background: -webkit-linear-gradient(-45deg, #a71068 0%, #a71068 29%, #e5632b 69%, #f19d2d 99%); /* Chrome10-25,Safari5.1-6 */ background: linear-gradient(135deg, #a71068 0%, #a71068 29%, #e5632b 69%, #f19d2d 99%);
}
.calc-body { color: #fff; font-size: 2rem; margin: 40px; border: 1px solid #fff;
}
.calc-output { display: block; width: 100%; padding: 20px;
}
.output { overflow: hidden; position: relative; background: rgba(0, 0, 0, 0.5); padding: 5px 10px; min-height: 48px;
}
.calc-buttons { padding: 20px 10px 8px 20px; width: 100%; display: block; border-top: 1px solid #fff; border-collapse: collapse;
}
.calc-buttons ul,
.calc-buttons li { list-style: none; padding: 0; margin: 0;
}
.calc-buttons li { border: 1px solid #fff; float: left; width: 22%; text-align: center; margin-right: 3%; background: rgba(255, 255, 255, 0.2); height: 60px; display: block; padding: 10px; margin-bottom: 12px; cursor: pointer; position: relative; border-bottom: 3px solid #eee;
}
.calc-buttons li:hover { border-bottom: 3px solid #f19d2d; margin-top: 1px; margin-bottom: 11px;
}
.calc-buttons .sum { background: rgba(0, 0, 0, 0.5); width: 47%;
}
.calc-buttons .sum:active, .calc-buttons .sum:focus { background: black;
}
.calc-buttons .delete { background: rgba(200, 0, 0, 0.5); width: 72%;
}
.calc-buttons .delete:active, .calc-buttons .delete:focus { background: #c80000;
}
.calc-buttons .nope { visibility: hidden;
}
.calc-buttons .action { background: rgba(200, 20, 20, 0.5);
}
.calc-buttons .math { background: rgba(133, 133, 133, 0.5);
}
.calc-buttons .math:focus, .calc-buttons .math:active { background: #858585;
}
.clear { display: block; clear: both;
}
.copy { cursor: pointer; position: absolute; right: -3px; background: #ccc; padding: 3px 5px; color: #585858; font-size: 11px; margin-top: -7px; text-transform: uppercase;
}
.copy:hover { background: #bbb;
}
.credits { text-align: center; padding: 0; margin: 0; font-family: 'Zeyada', cursive; font-size: 1.3rem;
}
.credits a { color: #fff; text-decoration: none;
}
.credits a:hover { color: #f19d2d;
}
.outputtext { text-align: right;
}
.log { font-size: 10px; min-height: 12px; color: #ffc20e;
}
FCC: Calculator - Script Codes JS Codes
/* Todo: check keyboard input */
var myClicks = [];
var lastnum = false;
function doMath(numarray) { var total = 0; var prevNum = 0; var numarray = numarray; for (var i = 0; i < numarray.length; i++) { if (numarray[i] === "÷") { numarray[i] = "/"; } else if (numarray[i] === "×") { numarray[i] = "*"; } } total = eval(numarray.join(""));
$('.log').html(total); myClicks = [total]; return (total);
}
function empty() { myClicks = []; $('.outputtext').html("0"); lastnum = false; $('.log').html("");
}
$('.calc-buttons li').click(function(e) { var button = $(this).text(); $('.log').append(button); if (button === "AC" || button === "DEL") { empty(); } else if (button === "=") { var result = doMath(myClicks); $('.outputtext').html(result); } else if ($(this).hasClass('math')) { $('.outputtext').html(button); myClicks.push(button); lastnum = false; } else { if (lastnum) { $('.outputtext').append(button); } else { $('.outputtext').html(button); lastnum = true; } myClicks.push(button); }
});
Developer | Jeanine |
Username | virtual |
Uploaded | September 12, 2022 |
Rating | 3 |
Size | 4,311 Kb |
Views | 20,240 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Parallax Cats | 6,553 Kb |
Flexbox | 2,263 Kb |
Font-Awesome Icon Card with heading | 2,882 Kb |
3 Piece Slider with featured center | 3,920 Kb |
Simple React Template | 2,233 Kb |
Simple Event Box | 1,623 Kb |
Bootstrap 4 | 2,121 Kb |
Table Sorter Data | 3,347 Kb |
3 Piece Slider | 3,881 Kb |
Expanding Info Boxes | 5,141 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Christ the Redeemer | Prashantsani | 2,208 Kb |
A Pen by Jess | Jessamyne | 5,100 Kb |
Kut D3 | Jellevrswk | 3,687 Kb |
A Pen by Bryan | Brydave | 2,286 Kb |
Ipad Mini Showcase | Hornebom | 10,479 Kb |
Flat UI Button | Honchoman | 2,289 Kb |
Myprofile | SoufianeAbid | 2,451 Kb |
Two tables and header with jspdf-autotable | Someatoms | 2,245 Kb |
SVG Animation | Thepheer | 4,793 Kb |
LDE old privacy page | Jasonangle | 2,339 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!