Team:UCC Ireland/ourlab.js

From 2014.igem.org

(Difference between revisions)
(Created page with "count = 0.0; initialwidth = 0.0; finalwidth = 0.0; $(document).ready(function () { count = $("#container > div").size(); initialwidth = (100.0 - (count + 1.0) * (2.5)) /...")
 
Line 6: Line 6:
     count = $("#container > div").size();
     count = $("#container > div").size();
     initialwidth = (100.0 - (count + 1.0) * (2.5)) / count;
     initialwidth = (100.0 - (count + 1.0) * (2.5)) / count;
-
     finalwidth = (50.0 - 2.5 - (count) * (2.5)) / (count - 1.0);
+
     finalwidth = (60 - 2.5 - (count) * (2.5)) / (count - 1.0);
     clear();
     clear();
});
});
Line 14: Line 14:
         setup();
         setup();
         $(this).css('opacity', 1);
         $(this).css('opacity', 1);
-
         $(this).css('width', '50%');
+
         $(this).css('width', '40%');
         $(this).find('p').css('visibility', 'visible');
         $(this).find('p').css('visibility', 'visible');
     }
     }

Latest revision as of 21:41, 15 October 2014

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 = (60 - 2.5 - (count) * (2.5)) / (count - 1.0);
   clear();

});

$("#container > div").hover(

   function () {
       setup();
       $(this).css('opacity', 1);
       $(this).css('width', '40%');
       $(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');
   }

}