I have seat plan for a hall and I am trying to create a seating booking system. How do I turn the checkbox red if a condition is met i.e. the seat is taken? Also, how do I make it stay red?
My seating plan and a box marked green when checked
Below is a snippet of my code for row A.
<!--A-->
<tr>
<td>A</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>
<input type="checkbox" class="seats" name="selected[]" value="A26">
</td>
<td>
<input type="checkbox" class="seats" name="selected[]" value="A25">
</td>
<td>
<input type="checkbox" class="seats" name="selected[]" value="A24">
</td>
<td>
<input type="checkbox" class="seats" name="selected[]" value="A23">
</td>
<td>
<input type="checkbox" class="seats" name="selected[]" value="A22">
</td>
<td>
<input type="checkbox" class="seats" name="selected[]" value="A21">
This is the relevant CSS code.
.smallBox::before {
content: "";
width: 15px;
height: 15px;
display: inline-block;
margin-right: 10px;
}
.greenBox::before {
content: "";
background: Green;
}
.redBox::before {
content: "";
background: Red;
}
.emptyBox::before {
content: "";
box-shadow: inset 0px 2px 3px 0px rgb(255, 152, 0), 0px 1px 0px 0px rgba(255, 255, 255, .8);
-moz-box-shadow: inset 0px 2px 3px 0px rgb(255, 152, 0), 0px 1px 0px 0px rgba(255, 255, 255, .8);
-webkit-box-shadow: inset 0px 2px 3px 0px rgb(255, 152, 0), 0px 1px 0px 0px rgba(255, 255, 255, .8);
background-color: #fff;
}
.seats {
border: 1px solid red;
background: yellow;
}
.seatGap {
width: 40px;
}
.seatVGap {
height: 40px;
}
input[type=checkbox] {
width: 13px;
margin-right: 14px;
cursor: pointer;
}
input[type=checkbox]:before {
content: "";
width: 25px;
height: 18px;
border-radius: 5px;
/* Safari 3-4, iOS 1-3.2, Android 1.6- */
-webkit-border-radius: 5px;
/* Firefox 1-3.6 */
-moz-border-radius: 5px;
display: inline-block;
vertical-align: middle;
text-align: center;
border: 3px solid #ff9800;
box-shadow: inset 0px 2px 3px 0px rgba(0, 0, 0, .3), 0px 1px 0px 0px rgba(255, 255, 255, .8);
-moz-box-shadow: inset 0px 2px 3px 0px rgba(0, 0, 0, .3), 0px 1px 0px 0px rgba(255, 255, 255, .8);
-webkit-box-shadow: inset 0px 2px 3px 0px rgba(0, 0, 0, .3), 0px 1px 0px 0px rgba(255, 255, 255, .8);
background-color: #ffffff;
}
input[type=checkbox]:checked:before {
background-color: Green;
font-size: 15px;
}
Please advise. Thank you.
Aucun commentaire:
Enregistrer un commentaire