Permalink
Browse files

Binary digits added to calculator

  • Loading branch information...
Franc Camps-Febrer Franc Camps-Febrer
Franc Camps-Febrer authored and Franc Camps-Febrer committed Nov 22, 2014
1 parent 8382752 commit 4af6d62e66caedfd3bdae2340726600a450a911e
Showing with 60 additions and 15 deletions.
  1. +3 −1 Calculator/calculator.js
  2. +40 −10 Calculator/index.html
  3. +17 −4 Calculator/main.css
View
@@ -19,6 +19,7 @@ $(document).ready( function () {
for (var i = 0; i < $(".card").length; i++){
if ($($(".card")[i]).hasClass("black")) {
counter += Math.pow(2, $($(".card")[i]).attr("data-slot"));
$($(".card")[i]).next().html(1)
}
}
@@ -28,7 +29,8 @@ $(document).ready( function () {
$("#total").click(function () {
$(".card").removeClass("black");
$(".card").addClass("white");
$("#total").html(0);
$("#total").html(0);
$(".card_frame > h3").html("0");
});
});
View
@@ -9,16 +9,46 @@
<div id="main">
<div id="deck">
<div class="card white" data-slot="9">512</div>
<div class="card white" data-slot="8">256</div>
<div class="card white" data-slot="7">128</div>
<div class="card white" data-slot="6">64</div>
<div class="card white" data-slot="5">32</div>
<div class="card white" data-slot="4">16</div>
<div class="card white" data-slot="3">8</div>
<div class="card white" data-slot="2">4</div>
<div class="card white" data-slot="1">2</div>
<div class="card white" data-slot="0">1</div>
<div class="card_frame">
<div class="card white" data-slot="9">512</div>
<h3 style="float: left">0</h3>
</div>
<div class="card_frame">
<div class="card white" data-slot="8">256</div>
<h3 style="float: left">0</h3>
</div>
<div class="card_frame">
<div class="card white" data-slot="7">128</div>
<h3 style="float: left">0</h3>
</div>
<div class="card_frame">
<div class="card white" data-slot="6">64</div>
<h3 style="float: left">0</h3>
</div>
<div class="card_frame">
<div class="card white" data-slot="5">32</div>
<h3 style="float: left">0</h3>
</div>
<div class="card_frame">
<div class="card white" data-slot="4">16</div>
<h3 style="float: left">0</h3>
</div>
<div class="card_frame">
<div class="card white" data-slot="3">8</div>
<h3 style="float: left">0</h3>
</div>
<div class="card_frame">
<div class="card white" data-slot="2">4</div>
<h3 style="float: left">0</h3>
</div>
<div class="card_frame">
<div class="card white" data-slot="1">2</div>
<h3 style="float: left">0</h3>
</div>
<div class="card_frame">
<div class="card white" data-slot="0">1</div>
<h3 style="float: left">0</h3>
</div>
</div>
<h2 id="total">0</h2>
</div>
View
@@ -24,6 +24,23 @@ h2#total:hover {
text-align: center;
}
.card_frame {
width: 90px;
float: left;
font-family: Helvetica, Arial, Sans-serif;
font-size: 38px;
font-weight: bold;
letter-spacing: -3px;
}
.card_frame h3 {
width: 100%;
clear: both;
margin: 10px 0px;
font-size: 22px;
color: #232323;
}
.card {
width: 70px;
height: 60px;
@@ -32,10 +49,6 @@ h2#total:hover {
border: solid 1px #232323;
border-radius: 5px;
float: left;
font-family: Helvetica, Arial, Sans-serif;
font-size: 38px;
font-weight: bold;
letter-spacing: -3px;
padding-top: 35px;
}

0 comments on commit 4af6d62

Please sign in to comment.