JSFiddle - React, Tailwind, and code Playground
by unloco
HTML
<script src="https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js" ></script>
<div id="header">
<h1>Header Title here</h1>
<p class="navigation">Some navigation links</p>
</div>
<div id="counter">
<h1>Counted:</h1>
<p class="numCount">0</p>
</div>
<div id="container">
<h2>Plus Achievements</h2>
<div class="unselect" id="1">
<table width="100%" border="0" cellpadding="6">
<tr>
<td width="64" valign="middle">
<img src="http://dl.dropbox.com/u/1733724/tf2icons/tf_complete_training.png"/>
</td>
<td valign="top" align="left">
<h3>Title Here</h3>
<p>Description Here</p>
</td>
</tr>
</table>
</div>
<div class="unselect" id="2">
<table width="100%" border="0" cellpadding="6">
<tr>
<td width="64" valign="middle">
<img src="http://dl.dropbox.com/u/1733724/tf2icons/tf_complete_training.png"/>
</td>
<td valign="top" align="left">
<h3>Title Here</h3>
<p>Description Here</p>
</td>
</tr>
</table>
</div>
<script>
</script>
CSS
body {
background-color: #FFBDBD;
font-family: Verdana, Geneva, sans-serif;
}
#header {
float: left;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: auto;
min-height: 100px;
background-color: #6A4E39;
text-align: left;
padding-left: 10px;
z-index: 1;
}
h1 {
font-size: 36px;
font-weight: bold;
color: #feffc4;
margin: 0;
margin-top: 5px;
}
h2 {
font-size: 24px;
font-weight: bold;
color: #6A4E39;
margin-top: 10px;
margin-bottom: 10px;
}
h3 {
font-size: 18px;
font-weight: bold;
margin: 0;
margin-top: 2px;
margin-left: -5px;
}
p {
font-size: 12px;
font-style: italic;
margin: 0;
margin-left: -5px;
}
.navigation {
font-size: 12px;
font-weight: bold;
color: #feffc4;
margin: 0;
margin-top: 5px;
}
a {
color: #feffc4;
}
#counter {
height: 100px;
width: 200px;
float: right;
position: fixed;
right: 0;
top: 0;
margin: 0;
z-index: 2;
text-align: center;
}
.numCount {
font-size: 32px;
font-weight: bold;
font-style: normal;
margin: 0;
color: #feffc4;
}
#container {
float: left;
position: relative;
top: 100px;
left: 0px;
width: 100%;
height: auto;
margin-left: auto;
text-align: center;
padding-bottom: 20px;
z-index: 0;
}
.unselect {
position: relative;
display: inline-block;
width: 425px;
height: auto;
min-height: 80px;
margin: 10px;
background-color: #feffc4;
color: #6A4E39;
border: #6A4E39 solid 2px;
cursor: default;
-webkit-user-select: none;
-khtml-user-select: none;
...
JavaScript
$(function(){
var selectedDivs = $.cookie("selected");
console.log(selectedDivs );
if(selectedDivs){
var IDs = selectedDivs.split(' ');
for(i=0;i<IDs.length;i++){
var ID = IDs[i];
if(ID) $('.unselect'+ID).toggleClass("select");
}
$('#counter').html('<h1>Counted:</h1><p class="numCount">' + $('.select').length + '</p>');
}
$(".unselect").click(function() {
$(this).toggleClass("select");
var numSelect = $('.select').length
$('#counter').html('<h1>Counted:</h1><p class="numCount">' + numSelect + '</p>');
var selectedDivs = "";
$('div.select').each(function(){
selectedDivs += " #" + $(this).attr('id');//every div has a unique ID
});
$.cookie("selected",selectedDivs, { expires: 30 });
console.log(selectedDivs);
});
});