Template:Peking2012 Color Modeling

From 2012.igem.org

(Difference between revisions)
m
m
Line 24: Line 24:
   </li><li class="trunk" style="background-image:url('/wiki/images/a/a2/Peking2012_Color_Title_FreshGreen.jpg');">
   </li><li class="trunk" style="background-image:url('/wiki/images/a/a2/Peking2012_Color_Title_FreshGreen.jpg');">
   <a href="/Team:Peking/Modeling/Channel">New Communication Channel</a>
   <a href="/Team:Peking/Modeling/Channel">New Communication Channel</a>
 +
  </li><li class="branch">
 +
  <ul class="vertical">
 +
  </ul>
   </li><li class="trunk" style="background-image:url('/wiki/images/f/fe/Peking2012_Color_Title_GrapePurple.jpg');">
   </li><li class="trunk" style="background-image:url('/wiki/images/f/fe/Peking2012_Color_Title_GrapePurple.jpg');">
   <a href="/Team:Peking/Modeling/Phototaxis">Phototaxis</a>
   <a href="/Team:Peking/Modeling/Phototaxis">Phototaxis</a>
 +
  </li><li class="branch">
 +
  <ul class="vertical">
 +
    <li>
 +
    <a href="/Team:Peking/Modeling/Phototaxis">Phototaxis</a>
 +
    </li><li>
 +
    <a href="/Team:Peking/Modeling/Phototaxis/Detail1">Appendix 1: Detail 1</a>
 +
    </li>
 +
  </ul>
   </li>
   </li>
  </ul>
  </ul>
Line 43: Line 54:
}
}
var handleFollowing = setInterval(Following,30);
var handleFollowing = setInterval(Following,30);
 +
</script><script type="text/javascript">
 +
/*
 +
* Peking 2012 Drawer
 +
* by Sun Sibai
 +
*/
 +
var sublists_Num = 4; //Total Number
 +
var sublists_Cur = 0; //Current Grow
 +
var sublists_Now = 0; //Current Page
 +
var subLhght = [120,120,120,90]; //Unit: Pixel
 +
var subLhght_Cur = [0,0,0,0]; //Unit: Pixel
 +
var subLhand_Wither = [null,null,null,null];
 +
var subLhand_Growth = null;
 +
var subLhand_Return = null;
 +
var sublists = subfirst.childNodes;
 +
for (var it=0;it<sublists_Num;++it)
 +
{
 +
  sublists[2*it+1].style.height=subLhght_Cur[it]+'px';
 +
  sublists[2*it+1].style.display='none';
 +
}
 +
/* Automatic Function */
 +
function listGrowth()
 +
{
 +
  subLhght_Cur[sublists_Cur] = subLhght_Cur[sublists_Cur] * 0.6 + subLhght[sublists_Cur] * 1.2 * 0.4;
 +
  if (subLhght_Cur[sublists_Cur]>=subLhght[sublists_Cur])
 +
  {
 +
    subLhght_Cur[sublists_Cur]=subLhght[sublists_Cur];
 +
    subLhand_Growth = null;
 +
    if (sublists_Cur!=sublists_Now)
 +
    {
 +
      subLhand_Return = setTimeout(listReturn,3000);
 +
    }
 +
    else
 +
    {
 +
      subLhand_Return = null;
 +
    }
 +
  }
 +
  else
 +
  {
 +
    subLhand_Growth = setTimeout(listGrowth,50);
 +
  }
 +
  sublists[2*sublists_Cur+1].style.height=subLhght_Cur[sublists_Cur]+'px';
 +
}
 +
function listWither(i)
 +
{
 +
  subLhght_Cur[i] = subLhght_Cur[i] * 0.6 - 2;
 +
  if (subLhght_Cur[i]<=0)
 +
  {
 +
    subLhght_Cur[i] = 0;
 +
    clearInterval(subLhand_Wither[i]);
 +
    subLhand_Wither[i] = null;
 +
    sublists[2*i+1].style.display='none';
 +
  }
 +
  sublists[2*i+1].style.height=subLhght_Cur[sublists_Cur]+'px';
 +
}
 +
function listReturn()
 +
{
 +
  listTrigger(sublists_Now);
 +
}
 +
function listTrigger(i)
 +
{
 +
  if (i!=sublists_Cur)
 +
  {
 +
    if (subLhand_Growth!=null)
 +
    {
 +
      clearTimeout(subLhand_Growth);
 +
      subLhand_Wither[sublists_Cur]=setInterval(function(){listWither(sublists_Cur);},50);
 +
    }
 +
    sublists_Cur = i;
 +
    if (subLhand_Wither[sublists_Cur]!=null)
 +
    {
 +
      clearInterval(subLhand_Wither[sublists_Cur]);
 +
    }
 +
    listGrowth();
 +
  }
 +
}
</script>
</script>
</html>
</html>

Revision as of 09:11, 14 September 2012