Template:Michigan Header2

From 2011.igem.org

(Difference between revisions)
Line 26: Line 26:
<!-- JAVASCRIPT FUNCTIONS -->
<!-- JAVASCRIPT FUNCTIONS -->
<script type="text/javascript">
<script type="text/javascript">
-
        var Acc1ContentHeight = 70;
 
-
        var Acc2ContentHeight = 105;
 
-
        var Acc3ContentHeight = 105;
 
var ContentHeight=100;
var ContentHeight=100;
var TimeToSlide = 250;
var TimeToSlide = 250;
var openAccordion = '';
var openAccordion = '';
-
function animate( lastTick, timeLeft, closingId, openingId )
+
function animate( lastTick, timeLeft, closingId, openingId, openHeight, closeHeight )
{   
{   
  var curTick = new Date().getTime();
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
  var elapsedTicks = curTick - lastTick;
-
 
+
             
  var opening = (openingId == '') ? null : document.getElementById(openingId);
  var opening = (openingId == '') ? null : document.getElementById(openingId);
  var closing = (closingId == '') ? null : document.getElementById(closingId);
  var closing = (closingId == '') ? null : document.getElementById(closingId);
Line 44: Line 41:
  {
  {
    if(opening != null)
    if(opening != null)
-
      opening.style.height = openingId + 'Height' + 'px';
+
      opening.style.height = (openHeight + 'px');
     
     
    if(closing != null)
    if(closing != null)
Line 55: Line 52:
 
 
  timeLeft -= elapsedTicks;
  timeLeft -= elapsedTicks;
-
  var newClosedHeight = Math.round((timeLeft/TimeToSlide) * ContentHeight);
+
  var newClosedHeight = Math.round((timeLeft/TimeToSlide) * closeHeight);
 +
                  var openFactor = Math.round((timeLeft/TimeToSlide) * openHeight);
  if(opening != null)
  if(opening != null)
Line 61: Line 59:
    if(opening.style.display != 'block')
    if(opening.style.display != 'block')
      opening.style.display = 'block';
      opening.style.display = 'block';
-
    opening.style.height = (ContentHeight - newClosedHeight) + 'px';
+
    opening.style.height = (openHeight - openFactor) + 'px';
  }
  }
   
   
Line 67: Line 65:
    closing.style.height = newClosedHeight + 'px';
    closing.style.height = newClosedHeight + 'px';
-
  setTimeout("animate(" + curTick + "," + timeLeft + ",'" + closingId + "','" + openingId + "')", 33);
+
  setTimeout("animate(" + curTick + "," + timeLeft + ",'" + closingId + "','" + openingId + "'," + openHeight + "," + closeHeight +" )", 33);
}
}
Line 78: Line 76:
}
}
-
setTimeout( "animate(" + new Date().getTime() + "," + TimeToSlide + ",'" + openAccordion + "','" + nID + "')", 33);
+
setTimeout( "animate(" + new Date().getTime() + "," + TimeToSlide + ",'" + openAccordion + "','" + nID + "," + openHeight + "," + closeHeight + "')", 33);
openAccordion = nID;
openAccordion = nID;
}
}
Line 93: Line 91:
<li><a href="https://2011.igem.org/Team:Michigan">Home</a></li>
<li><a href="https://2011.igem.org/Team:Michigan">Home</a></li>
-
<div onclick="runAccordion(1);">
+
<div onclick="runAccordion(1, 80, 100 );">
<li><a>Team</a></li>
<li><a>Team</a></li>
Line 111: Line 109:
<li><a href="https://2011.igem.org/Team:Michigan/Parts">BioBricks</li>
<li><a href="https://2011.igem.org/Team:Michigan/Parts">BioBricks</li>
-
                         <div onclick="runAccordion(3);">
+
                         <div onclick="runAccordion(3, 105, 100 );">
          <li><a>Human Practices</a></li>
          <li><a>Human Practices</a></li>
Line 124: Line 122:
                           </div>
                           </div>
-
                         <div onclick="runAccordion(2);">
+
                         <div onclick="runAccordion(2, 105, 100);">
      <li><a>Notebooks</a></li>
      <li><a>Notebooks</a></li>

Revision as of 14:30, 26 June 2011