Template:CSU Template 1 top

From 2012.igem.org

(Difference between revisions)
Line 266: Line 266:
</style>
</style>
<script type="text/javascript">
<script type="text/javascript">
-
 
-
//*********VARIABLE DOCUMENTATION*********
 
-
 
-
//slideTime: length of slide (milliseconds); must be same as fadeTime for dropdown menu
 
-
 
-
//fadeTime: length of fade (milliseconds); must be same as slideTime for dropdown menu
 
-
 
-
//fadeInc: fade Increments in opacity units: > means smoother, more CPU-intensive transition
 
-
 
-
//slideInc: slide Increments in pixels: > means smoother, more CPU-intensive transition
 
-
 
-
//slideStayTime: length that each slide shows before fade (in milliseconds)
 
-
 
-
//In order for fade to work correctly, opacity must be rounded to
 
-
//the appropriate number of decimal places.  roundTo defines this.
 
-
//For fadeInc < 20, roundTo = 1 will suffice.  roundNum is the
 
-
//functional form.
 
//newOpac: sets new opacity
//newOpac: sets new opacity
Line 293: Line 276:
function fade(curElemID,isFading) {
function fade(curElemID,isFading) {
 +
//length that each slide shows before fade (in milliseconds)
var slideStayTime = 2000;
var slideStayTime = 2000;
 +
 +
//length of fade (milliseconds)
var fadeTime = 1000;
var fadeTime = 1000;
-
var fadeInc = 10;
+
 +
//number of fade loops: > means smoother, more CPU-intensive transition
 +
var numFadeLoops = 10;
 +
 +
//In order for fade to work correctly, opacity must be rounded to
 +
//the appropriate number of decimal places.  roundTo defines this.
 +
//For numFadeLoops < 20, roundTo = 1 will suffice.  roundNum is the
 +
//functional form.
var roundTo = 1;
var roundTo = 1;
var roundNum = Math.pow(10, roundTo);
var roundNum = Math.pow(10, roundTo);
Line 328: Line 321:
//Sets new opacity and reruns the function
//Sets new opacity and reruns the function
-
var newOpac = (Math.round(roundNum * (parseFloat(curElem.style.opacity) - (1/fadeInc)))) / roundNum;
+
var newOpac = (Math.round(roundNum * (parseFloat(curElem.style.opacity) - (1/numFadeLoops)))) / roundNum;
curElem.style.opacity = newOpac;
curElem.style.opacity = newOpac;
-
setTimeout('fade(' + curElemID + ')', (fadeTime/fadeInc));
+
setTimeout('fade(' + curElemID + ')', (fadeTime/numFadeLoops));
//Current slide has faded completely
//Current slide has faded completely

Revision as of 16:56, 25 July 2012