Team:UCC Ireland/ourlab.js
From 2014.igem.org
count = 0.0; initialwidth = 0.0; finalwidth = 0.0;
$(document).ready(function () {
count = $("#container > div").size(); initialwidth = (100.0 - (count + 1.0) * (2.5)) / count; finalwidth = (50.0 - 2.5 - (count) * (2.5)) / (count - 1.0); clear();
});
$("#container > div").hover(
function () { setup(); $(this).css('opacity', 1); $(this).css('width', '50%'); $(this).find('p').css('visibility', 'visible'); } , function () { $(this).css('opacity', 1); clear(); }
);
function clear() {
//brings back to original state. for (i = 1; i <= count; i++) { $('#col' + i.toString()).css('width', initialwidth.toString() + "%"); $('#col' + i.toString() + "> p").css('visibility', 'visible'); }
}
function setup() {
for (i = 1; i <= count; i++) { $('#col' + i.toString()).css('width', finalwidth.toString() + "%"); $('#col' + i.toString() + "> p").css('visibility','hidden'); }
}